Custom Logging Options in NodeRed

I need to capture flow wise activity tracking in Node Red and write the captured data to a file.I need to capture the following information Flow Name,Flow Session Id, Node Id , Node Name, Type of Node Event(Eg Send/receive) ,Message Id ,Payload , Input received in Node .How can I achieve the same in Node Red? I have gone through the custom logger option using settings.js and was able to write the entire contents of the logger object received to a file.Details like Payload,Flow Name,Flow Session are missing.Are there any built in functions in Node Red which could capture all the above mentioned details and log the same to a file?


Hi @suryas

the only thing available to you is to enable the metrics option in the logger to get stats from messages passing between nodes. That is all the information available to the logger.

There is no such concept as 'Flow Session Id' or 'Flow Name' in Node-RED, so that information just doesn't exist, and the metrics api is about statistics, so doesn't include message payloads.

In a future release we'll have a pluggable message routing component that will allow you to add custom code to the message path between nodes - that would allow you to capture whatever you wanted.


Do you know where I can see these logs when you have node red running on docker? Also do you have an example code on how I can get the metrics logged to a text file?