Callback in Node red

#1

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?

0 Likes

#2

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

#3

You could store a status value in a global context and present each state on a dashboard.https://nodered.org/docs/user-guide/context

0 Likes

#4

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

0 Likes

#5

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.

0 Likes

#6

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

0 Likes

#7

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