Settings: log_file = "filename" and log_rotate_duration = "24h" not working (need help)

211 views
Skip to first unread message

Predrag Zečević

unread,
Jun 27, 2019, 5:57:04 AM6/27/19
to Consul
Hi All,

Sorry IF I have missed explanation for similar questions (searched a lot, but I could not find solution/explanation).

Basically, I have cluster working and few agents connected to.

Problem manifests differently on CentOS 6 and CentOS 7, although these settings are same:

log_rotate_duration = "24h"
log_file = "/var/log/consul-{timestamp}.log"


In both cases, "24h" is not used (or handled) at all: there is NO rotation of log file performed - which I would expect

CentOS 6 log to /var/log/consul.log (I would expect timestamp, like described in https://www.consul.io/docs/agent/options.html#_log_file)
CentOS 7 does not log anywhere, but to /var/log/messages

Version is 1.5.1, on both systems installed (and runs as user consul, group consul) from https://releases.hashicorp.com/consul/1.5.1/consul_1.5.1_linux_amd64.zip

So, what are proper way to set:
  • log_file so it includes timestamp (e.g.- what is proper format to get filename like /var/log/consul-YYYYDDMM.log)?
  • log_rotate_duration so the log file is rotated on daily basis?
  • How to make CentOS 7 version to write to log_file above?

systemd unit file used on CentOS 7 (tried without -log-file option, does not give different results):

[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/docs/index.html
Requires=network-online.target
After=network-online.target
ConditionFileNotEmpty=/etc/consul.d/consul.hcl

[Service]
User=consul
Group=consul
ExecStart=/opt/consul/bin/consul agent -config-dir=/etc/consul.d/ -log-file=/var/log/consul.log
ExecReload=/opt/consul/bin/consul reload
KillMode=process
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

Any help is welcome

Best regards
Reply all
Reply to author
Forward
0 new messages