Node-RED Logging

Does anyone here know how to make a logging system for Node-RED events similar to the logging system with HE? I would love to be able to track small bugs in my system without debug nodes everywhere.

There seems to be a console logger for NR, but I was wondering if anyone knows of a more convenient or streamlined approach.

Bonus points for a code profiling system like the recent HE updates have added to see bad algorithms or issues with my sequences/flows.

1 Like

I’d be interested in reading about that too.

1 Like

Just thinking aloud - maybe you could do something with a “Status” node and select the nodes that you are interested in logging?

There is an events node, but it hits everything, so I don’t know how heavy it would be on a system grabbing everything that is coming through it. I’ve used it for troubleshooting a time or two. You could pipe that into a file of some sort, I’m sure.

I feel like @jchurch might have some ideas. I’m always bugging him when I need node red guidance.

Are you referring to the HE events node? That’s what I use to log all HE events from node-red. However, if you want to log what’s happening in your flows, the built-in status node may be more applicable?

Maybe look into NR logging here and add a custom logger that sends metrics events to a Logstash instance over a TCP connection.

2 Likes

:grin: :point_up:
What he said!

1 Like

Yah but I thought it was a system node not an HE node because I didn’t check first. I was mistaken. But, that’s how we learn.

1 Like

Yeah I don’t think think the status node would work, to my knowledge that is for showing the status text that appears below a node onto another node (in the case of a subflow) or just outputting that text as a payload. But it deals specifically with the status text that shows below a node, for instance time left on a timer, or in the case of HE nodes, the current status or function to activate.

Yeah I saw that, but boy does that seems like an undertaking…which was why before I get into the weeds I wanted to see if anyone had any other suggestions.

1 Like

Long time no update, is there any “nice” way of getting this debug node outputs when NR UI is not open? I am okay with debug nodes but sometimes things happen when the NR UI is not running. I have a couple of motion/lux/presence/time flows which I would love to see some more information after I realize a light is on that shouldn’t.

You could output to the system console and monitor from there. I’ll do a bit of digging on this for you, I swear I was doing this briefly 2 years ago on my pi before moving to VMs, but Im blank as to how.

2 Likes

There are some contributed logging nodes but I’ve not tried any of them. I’ve always used the system console option in the Debug node as @RRodman suggests.

1 Like

I’ve taken the simple approach before of using a “write file” node in place of or in parallel with debug nodes.

On core you’d just need to use the correct path to the file, in the node would be something like “/data/node-red/filename” which via SSH/SFTP would be located at “/home/core-services/data/node-red/filename” for NR2 and “/home/oh-la/data/node-red/filename” for NR3. My only concern with that simple approach is that file could continue to grow indefinitely

1 Like