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[0].json.processStart = new Date();
return items;
which runs as the first node of the workflow, and:
items[0].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.processStart
and 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
Function
nodes the only way?