Haproxy installed on CentOS 7, the log is not logged by default. You need to do a configuration to log the logs.
1. Create a log file/var/log/haproxy/haproxy.log
Cd/var/logsudo mkdir haproxycd haproxysudo touch haproxy.logsudo chmod a+w haproxy.log
2. Turn on the Rsyslog haproxy logging function
Edit the/etc/rsyslog.conf file to
$ModLoad Imudp$udpserverrun 514
The # before two lines is removed.
In
# Save Boot messages also to boot.loglocal7.* /var/log/boot.log
After adding
# Save Haproxy loglocal0.* /var/log/haproxy/haproxy.log
Modify the/etc/sysconfig/rsyslog file to
Syslogd_options= ""
Switch
Syslogd_options= "-r-m 0-c 2"
3. Configure Haproxy
Modify the/etc/haproxy/haproxy.cfg file and add it in the global section
Log 127.0.0.1 local0
Restart the Rsyslog and Haproxy services, and Haproxy will be able to log the logs.
Configuring Haproxy to increase logging capabilities