如何禁用Node-RED向syslog输出日志?
Got it, let's tackle this issue where Node-RED is duplicating logs to syslog even though you're redirecting console output to a file. The official docs don't explicitly mention syslog configuration, but we can work around that by directly configuring the underlying logging transport.
Step 1: Update your settings.js
Node-RED uses the Winston logging library under the hood, which enables a syslog transport by default. To disable it, you just need to add a syslog block to your logging config and set it to disabled:
// Configure the logging output logging: { console: { level: "warn", metrics: false, audit: false }, // Add this block to disable syslog logging syslog: { enabled: false } },
Step 2: Restart Node-RED
Apply the changes by restarting your Node-RED instance with your existing startup command:
node /usr/src/node-red/node_modules/node-red/red.js --userDir /data flows.json >> /data/node-red.log 2>&1
Why this works
Even though the official Node-RED logging docs don't call out syslog, the Winston integration includes it as a default transport. By explicitly setting enabled: false for syslog, you're telling Node-RED to only send logs to the console transport—which you're already redirecting to your /data/node-red.log file, perfect for your Kubernetes setup.
Verify the fix
After restarting:
- Check your
/data/node-red.logfile to confirm it still captureswarnand higher level logs as expected. - On your Kubernetes nodes, check the system syslog (typically
/var/log/syslogor viajournalctlfor systemd systems) to ensure no duplicate Node-RED entries are appearing there anymore.
内容的提问来源于stack exchange,提问作者Dennis R

