You can configure your system to log HAProxy messages to
rsyslog by writing to the
/dev/log socket. Alternately you can target the TCP loopback address, however this results in slower performance.
The following procedure configures HAProxy to log messages to
global section of the HAProxy configuration file, use the
log directive to target the
log /dev/log local0
listen proxies to send messages to the
rsyslog service you configured in the
global section of the HAProxy configuration file. To do this, add a
log global directive to the
defaults section of the configuration file, as shown.
If you are running HAProxy within a
chrooted environment, or you let HAProxy create a
chroot directory for you by using the
chroot configuration directive, then the socket must be made available within that
chroot directory. You can do this by modifying the
rsyslog configuration to create a new listening socket within the
chroot filesystem. To do this, add the following lines to your
rsyslog configuration file.
To customize what and where HAProxy log messages will appear, you can use
filters as described in Basic Configuration of Rsyslog
in the System Administrator's Guide