Configure HaProxy logs


In order to enable logging for HaProxy, edit /etc/sysconfig/rsyslog file and make the single line in it to match the following:

SYSLOGD_OPTIONS="-c 2 -r"

As a matter of fact the “-r” key should be added to the options of the rsyslog daemon in order to make it accept events on the ip socket.

Next edit the /etc/rsyslog.conf file:
1. Uncomment the following lines:

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

and

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

2. Now we need to create the corresponding logfacility. If the global section of your haproxy.cfg has the following

log         127.0.0.1 local2

than update rsyslog.conf with the following line:

local2.*                                                /var/log/haproxy.log

Restart rsyslog to apply the changes:

/etc/init.d/rsyslog restart

Share Button

Leave a Reply

You must be logged in to post a comment.