Thursday, 2 June 2016

Logging to file with haproxy

By default haproxy logs information to syslog - in order to get the output piped out to a text file we should perform the following:

sudo vi /etc/rsyslog.d/49-haproxy.conf

and ensure the following line is uncommented / present:

if $programname startswith 'haproxy' then /var/log/haproxy.log

This simply instructs the syslog daemon to pipe out any data submitted by the process 'haproxy' to /var/log/haproxy.log

You should also ensure that the syslog daemon is running:

sudo vi /etc/rsyslog.conf

and ensuring the following is uncommented:

$ModLoad imudp
$UDPServerRun 514
$UDPServerAddress 127.0.0.1

sudo service rsyslogd restart

tail -f  /var/log/haproxy.log

and try generating some traffic...

0 comments:

Post a comment