Wednesday 30 March 2011

haproxy and rsyslog on ubuntu

Since there its a bit a mystery how to enable logging on haproxy i will put down what i did to make it work.

ubuntu 10.04 (should work with other releases also)


Create a file in /etc/rsyslog.d/20-haproxy.conf whick looks like:

$ModLoad imudp $UDPServerRun 514  local0.* -/var/log/haproxy_0.log local1.* -/var/log/haproxy_1.log 


in file 50-default.conf edit the line to look like:

*.*;auth,authpriv,local0,local1.none     -/var/log/syslog 

Restart rsyslog

Setup logrotate

in /etc/logrotate.d/haproxy

/var/log/haproxy.log {     rotate 4     weekly     missingok     notifempty     compress     delaycompress     sharedscripts     postrotate         reload rsyslog >/dev/null 2>&1 || true     endscript }


Happy logging




No comments:

Post a Comment