Callback in Node red


I have lot of flows in my node red project, i want to track each and every flow, after success of each flow i want do some action like store data in db flow1 successfully injected , how can track each and every flow?



Right now you have to explicitly create the flows to do what you want. The node-red runtime has no concept of a flow being 'successful' - so there's nothing to hook into for what you want.

In the future, we will have a new node api that will allow nodes to tell the runtime they have finished with success. That will come with a new 'Complete' node that can be used to trigger (much like the Status/Catch nodes). However, even once we release the new api, it will take some time to be adopted - there are 1700+ nodes out there, many of which are not actively maintained.

1 Like


You could store a status value in a global context and present each state on a dashboard.



@knolleary how can i log my flow, i mean each node executed or not with timings start time and end time



Enable the metrics log level in settings.js.

You may want to create a custom logger to handle just the metrics events rather than flood your main log. The docs have some details.

Whether that gives you what you want, you'll have to try and see.



@knolleary how can i put in all logs in file like access.log, error.log files



There is only a single, unified log in Node-RED, it isn't like a web server in the traditional sense.

If you have a separate reverse proxy in front of the Node-RED service and want those logs and Node-RED's all in one place, you will need some kind of log aggregation service.

1 Like