1

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?

Saveendra Ekanayake
  • 3,153
  • 6
  • 34
  • 44
drafterr
  • 623
  • 8
  • 14

2 Answers2

2

Using nodered.service for autostart you can uncomment parameter StandardOutput=syslog and all logs will be direct into /var/log/syslog file.

0

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

Community
  • 1
  • 1
hardillb
  • 54,545
  • 11
  • 67
  • 105