I want to log each process run, by setting a starting and ending timestamp.
At present I have two
Function nodes, with code like this:
items.json.processStart = new Date(); return items;
which runs as the first node of the workflow, and:
items.json.processEnd = new Date(); return items;
which runs after all other nodes have completed.
These are then merged, and fires a set of nodes that use the
json.processEnd values from the
Merge node, to insert this into an auditing table in my PG database.
It works well, but I was wondering:
- Is this the best approach?
- Does n8n have the concept of global variables that I can use to set these values? Or, is using the output from
Functionnodes the only way?