HAProxy provides built-in syslog support and can be enabled pretty easily - in your configuration within the 'defaults' stanza add something like the following:
log 127.0.0.1 haproxy notice
and then in your rsyslog.conf we add / uncomment:
$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
We will also want to add the following to ensure that haproxy logs are stored elsewhere -
sudo vi /etc/rsyslog.conf
and insert the following at the top of the '#### RULES ####' section:
if $programname startswith 'haproxy' then /var/log/haproxy.log
Reload rsyslog and haproxy:
sudo service rsyslog reload
sudo service haproxy reload
and then generate some traffic on the proxy and then review the logs:
tail -f /var/log/haproxy.log
0 comments:
Post a Comment