Consul and logs


Here is a piece of my consul configuration:

"enable_syslog": false,
"log_file": "/var/log/consul/consul.log",
"log_level": "INFO",
"log_rotate_bytes": 52428800,
"log_rotate_duration": "24h",
"log_rotate_max_files": 7,

The binary is started by systemd with this options:

/usr/local/bin/consul agent -config-file=/etc/consul/config.json -config-dir=/etc/consul/consul.d -pid-file=/run/consul/

This generates log file correctly in /var/log/consul.
However the binary outputs his logs to /dev/stdout also. These logs are stored in /var/log/daemon.log (binary => systemd => syslog).

What is the best way to disable this logs ?

What about appending your command with >/dev/null 2>&1? Your process is running in the foreground, so using nohup <command> </dev/null >/dev/null 2>&1 & could help, too.

1 Like

Perhaps putting this in the systemd configuration is more elegant:


You haven’t mentioned systemd. :smiley: I should have asked as I’d wanted to.