sivachinnayan / consul-cluster-setup

setup consul cluster setup
MIT License
0 stars 0 forks source link

How to reduce Consul Logs #11

Open sivachinnayan opened 8 years ago

sivachinnayan commented 8 years ago

Within a week with 4 services running with max of 2 nodes on/off threw log size of more than 110 MB, There needs to be a log rotation to keep in check the log size.

[root@localhost log]# ls -rlth consul.log 
-rw-r--r--. 1 root root 114M Aug 31 14:33 consul.log
[root@localhost log]# 
sivachinnayan commented 8 years ago

Added logrotate configuration:

$  vim /etc/logrotate.conf
/var/log/consul.log {
        size 100M
        copytruncate
        rotate 4
        compress
}

apply changes logrotate for the /etc/logrotate.conf starting logrotate

$logrotate  /etc/logrotate.conf

After running the logrotate against logrotate.conf, the result show consul logs are copied and trucncated.

$ls -rlth consul.log*
-rw-r--r--. 1 root root 3.3M Sep  2 15:12 consul.log-20160902.gz
-rw-r--r--. 1 root root 106K Sep  2 15:19 consul.log