After installing Haproxy, the log is logged by default in the System log. In order to make it easier to debug and view the logs, we need to peel off the haproxy logs.
Before configuring, let's first understand the level:local0~local7 of the log 16~23 reserved for local use
1234567 Debug information
To edit the/etc/rsyslog.conf configuration file:
# provides UDP syslog reception # The following comment must be opened, otherwise haproxy cannot write to the log 514#save haproxy log to/var/log/haproxy.log# the level 3 here is consistent with the levels defined in the Haproxy configuration file local3.* /var/log/haproxy.log
To edit the haproxy.cfg configuration file:
Global Log 127.0.0.1 local3# The logging level here is consistent with Rsyslog
When you're done editing, restart the service.
# /etc/init.d/rsyslog Restart # /etc/init.d/haproxy Restart
Haproxy Configuration Log Display