Selasa, 28 Januari 2020

How to rotate haproxy info log with log rotate in linux

  Tidak ada komentar
The script
[myuser@loadbalance ~]$ cat /etc/logrotate.d/haproxy
/var/log/haproxy.log {
    daily
    rotate 10
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
[myuser@loadbalance ~]$
The result
[myuser@loadbalance log]$ ls -l
total 11721548
drwxr-xr-x. 2 root   root         4096 Dec  8  2015 anaconda
drwx------. 2 root   root           94 Jan 28 22:24 audit
...
...
-rw-r--r--  1 root   root          296 Aug 18  2017 grubby_prune_debug
-rw-------  1 root   root     12418990 Jan 29 01:37 haproxy-allbutinfo.log
-rw-------  1 root   root     71729139 Jan 29 09:32 haproxy-info.log
-rw-------  1 root   root     92709637 Jan  9 03:34 haproxy-info.log-20200109.gz
-rw-------  1 root   root     90156952 Jan 11 03:32 haproxy-info.log-20200111.gz
-rw-------  1 root   root    103152189 Jan 14 03:35 haproxy-info.log-20200114.gz
-rw-------  1 root   root     96725226 Jan 16 03:24 haproxy-info.log-20200116.gz
-rw-------  1 root   root     89752038 Jan 18 03:21 haproxy-info.log-20200118.gz
-rw-------  1 root   root    107073804 Jan 21 03:10 haproxy-info.log-20200121.gz
-rw-------  1 root   root     93141582 Jan 23 03:22 haproxy-info.log-20200123.gz
-rw-------  1 root   root    102277415 Jan 25 03:34 haproxy-info.log-20200125.gz
-rw-------  1 root   root     71145364 Jan 27 03:49 haproxy-info.log-20200127.gz
-rw-------  1 root   root    111749083 Jan 29 03:42 haproxy-info.log-20200129.gz
drwx------  2 root   root            6 Aug  8 18:42 httpd
-rw-r--r--. 1 root   root       294336 Jan 29 09:28 lastlog
-rw-------  1 root   root          536 Jan 29 03:42 maillog


Tidak ada komentar :

Posting Komentar