Rotate haproxy logs

Posted by Jagbir on Server Fault See other posts from Server Fault or by Jagbir
Published on 2014-06-02T07:26:01Z Indexed on 2014/06/02 9:31 UTC
Read the original article Hit count: 578

Filed under:

I tried few things but still not able to rotate haproxy logs efficiently. I need to rotate logs when log files crosses 500 MB size. Considering haproxy is serving large no. of static tcp connections, I can not restart haproxy process though a reload is doable. Daily haproxy log file size normally crosses 3 GB on my machine. Here's sample from one of newer machine where log file size is growing beyond limit set:

[email protected]:/mnt/log/haproxy$ ls -lsh
total 4.3G
85M -rw-r----- 1 syslog adm  85M Jun  2 07:13 haproxy.log
2.9G -rw-r----- 1 syslog adm 2.9G Jun  2 06:37 haproxy.log.1
460M -rw-r----- 1 syslog adm 460M Jun  1 06:32 haproxy.log.2.gz
469M -rw-r----- 1 syslog adm 469M May 31 06:42 haproxy.log.3.gz
384M -rw-r----- 1 syslog adm 384M May 30 06:49 haproxy.log.4.gz

[email protected]:/mnt/log/haproxy$ cat /etc/logrotate.d/haproxy
/mnt/log/haproxy/haproxy.log {
rotate 50
size 500M

© Server Fault or respective owner

Related posts about haproxy

Related posts about logrotate