Troubleshooting what triggered a flow

Hi everyone,

I am quite new to Node-RED and have a basic problem:

tl;dr: I have a flow with 3 potential trigger nodes. This node is trigger at times when it shouldn't and I want to troubleshoot why. I tried debug nodes, but they do not have persistence, so I cannot check it unless I have Node-RED open at that time (and that's not the case). What could I do to have persistent debug logs and/or a way to capture all messages from this or all flows.

This is how the Flow looks like:

As long as I have the tab open, this is easy, as I can see the debug messages. Moreover, I've added a msg.trigger to each of those initial nodes (Living room is dark, After sunset, and After sunset time) so I can easily identify which one triggered the whole flow.

The problem is that when these may trigger when I do not have the UI open. Also, leaving it open for 24h does not help as debug messages seem to stop coming in after a while (I guess if the laptop/window becomes inactive?)

What do you recommend here? How do you usually debug what triggered a flow?

My top ideas were:

  1. Get these debug messages nodes to be persistent. I didn't find anything like this. I saw the file node, but I really want something that looks like the debug console or a logs file. I would assume this is possible via settings, but I didn't manage to find anything related; except logging, which I am not sure if it's the same.

  2. Find a way to log every single message on the flow as they pass through. I didn't find anything like this.

PS: This is probably a super basic question answered many times, but I didn't manage to find any similar topics (probably searching the wrong queries).

If you configure the debug nodes to output to the console then the output will be logged there. If you are running a Linux system such as on a Pi then you can use journalctl to look back at them (or just look in /var/log/syslog).

1 Like

Or use something like flogger instead of/as well as debug nodes

1 Like

@Colin that worked. I am using Docker, so used docker logs <container> instead, but same results. Thanks!

@Steve-Mcl For some reason, the flogger link didn't work for me, but I assume you mean this node. I tried it, really nice too and solves the issue. Slightly more configurable than simply outputting the debug nodes. Thanks!

I did mean that node yes (I fixed the link too)

Thanks for taking the time to fix it too. By the way, I've marked Colin's answer because it came first, solves the problem and it's technically closer to the question. However, I am actually using Flogger finally as I can create one file per flow and that makes it a lot easier to isolate and have a history track. :slight_smile:

If you want something that is always there showing what is going on then certainly flogger is a good solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.