I have a docker instance of node-red and I want to save node-red console logs into a separate log file inside the docker container. Is there any method to do it?
-
It's very hard to answer this without knowing how you're starting node-red in the docker container – hardillb May 19 '17 at 10:53
-
i am starting node-red in docker by using kubernetes. Can i be able to save node-red logs in the container ? – drafterr May 22 '17 at 05:24
-
That is how you are starting the container, not how you are starting Node-RED – hardillb May 22 '17 at 08:08
2 Answers
Using nodered.service for autostart you can uncomment parameter StandardOutput=syslog and all logs will be direct into /var/log/syslog file.

- 31
- 3
The Node-RED process only logs to console at the moment, but you can redirect the output to a file using normal unix redirects e.g.
node-red > /path/to/log/file
The Node-RED service on Raspbian uses systemd to redirect the output to syslog with the identifier "Node-RED" so this could also be directed to a separate file.
The standard Node-RED docker containers just start Node-RED as the CMD. You can configure how docker logs that content using the details in the docker docs here: https://docs.docker.com/engine/admin/logging/overview/#configure-the-logging-driver-for-a-container.
If you want to modify the CMD to redirect the outut to somewhere inside the container then this SO question and answer will probably be useful: Redirecting command output in docker