Where can I read Node Red logs?

Hi! I'm sure soeone esle has already asked about this in past, but googling it I can't find a proper answer, also searching here in the forum.
THis night my Raspberry for the first time had a problem, the IP protocol stopped somehow, I guess it's a kernel problem, this morning the ping worked but I can't open more node red page, not SSH and Alexa can't connect to the mapped port 80.
I reboot it and in var/logs i the messages file I have:
eb 7 04:33:49 raspberrypi kernel: [204905.473054] Voltage normalised (0x00000000)
******************************************* Feb 7 12:52:25 raspberrypi mtp-probe: checking bus 1, device 3: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1"
Feb 7 12:52:25 raspberrypi mtp-probe: bus: 1, device: 3 was not an MTP device

Where I wrote ******** I have 2 lines of NUL chars, I can't type them here.

I would like to read the log file of Node Red, where this file is? Which path? Thanks.
I also would like to log qite everything, of the last 48hours, if it possible to do. To don't have big impact on the system I would like to delete logs before 48 hours, is it possible to do?
Mayb the idea is to create a file for every day and tell Node Red to delete previous files every day. It's really useful for debugging
Thank you for help!

1 Like

The log file location depends on how you run Node-RED. For example if you run Node-RED using pm2 it will be different that if you run straight from the command line.

If you are using the pi install you can run the command as listed on the raspberry pi page in the docs.

You can change the amount of logging in your settings.js file again the docs explain how.

As they use the systems logging they will automatically get cleaned up.

I used sudo systemctl enable nodered.service as in the main instructions, I installed node red without root, where are log files? what names they have? only console.log?

I suppose that here is how to manage the logging level:
how many days will it be preseved and aftr cleaned? thanks

If you are using a raspberry pi the answers to some of the questions are on the Raspberry Pi page in the documentation.

How many days are preserved of the logs on a raspberry pi? That's a question you can google.

In this guide I can't find the path:

Somebody please know it? Thank you

Hi @Barabba11

if you have followed the Raspberry Pi install docs here: https://nodered.org/docs/hardware/raspberrypi then, as described on that page, then you should also have the node-red-log command.

But if you haven't used our install script, you won't have that command. In which case, you should be able to use

sudo journalctl -f -u nodered -o cat

to get the logs from the service.

1 Like

both of them working, thank you, but I can see only data only from the last time it started. Any chances to see the contant of the file with old logs? I need to know what happeed this night.
Maybe as default Node red doesn't log to file, and add history at avery restart (instead of delete all previous data). How to have this journal then?

When running as a service, the log is entirely managed by journald outside of node-red. I haven't looked at what configuration options it provides, but I assume it must provide options to extend the history it keeps. A quick google on the topic finds this: https://www.loggly.com/ultimate-guide/linux-logging-with-systemd/ which may help you.

If you look in /var/log/syslog you will see it is there also, but mixed up with all the other syslog stuff.

1 Like

Colin thanks, yes there I can see all, mixed up. For me it's ok since I can see what happened in the night. It's not Node red (but it was working instead), it was the kernel, the IP TCP was not more working and also logging was stopped, so I don't have many elements..

I add this to my package.json file scripts section so that I can run the command npm run log. That way I don't have to remember the ugly, complex command.

If you are feeling adventurous, you could easily amend your systemd node-red startup script to redirect output to a different log file in /var/logs/ I think that journalctl will pick that up automatically - if not, you would need to alter its config if you needed that. You should also look at /etc/logrotate.conf to make sure your node-red logs get rotated otherwise they will keep growing. (the default setup is rotated automatically).

Which is why we alias it to node-red-log

1 Like

Which is great for those people sensible enough to install via the standard method :smile:

Sadly, I've never been much of a follower.

No need to drag others off the path :slight_smile:


But that apple looks soooooo tempting Mr Adam!

Just a short feedback from me, I've found very useful to read the whole Raspberry log, so I can also check how the system is working, not only Node Red, anyway to filter it I've founf useful the suggestions here, with a small change.

sudo journalctl -n 30 -u nodered -o cat
where 30 is the last 30 lines logged from Node Red, change the number as your needs. it seems keep also the console on the logging and if something is incoming it will show you, to exit press control+C.
Thank you

That is almost exactly what the node-red-log command we install on a Pi will do for you :slight_smile:
sudo journalctl -f -n 25 -u nodered -o cat

Where I can find the logs of node-red in windows?
And I'm using the command "node-red" for starting the node-red

Also asked and answered in a new thread Where I can get the debug logs of node-red?