The configuration file involved is as follows: 1)/etc/haproxy. conf // This is the main configuration file of the haproxy program. the specific path can be specified at will, mainly in the following sentence: log
The configuration file involved is as follows: 1)/etc/haproxy. conf // This is the main configuration file of the haproxy program. the specific path can be specified at will, mainly in the following sentence: log localhost local0 2)/etc/rsyslog. conf // This configuration file does not need to be moved. by default, the following settings will be used to read/etc/rsyslog. d /*. configuration file $ IncludeConfig/etc/rsyslog under the conf Directory. d /*. conf 3)/etc/rsyslog. d/haproxy. conf // This file needs to be created manually. the content is as follows: cat/etc/rsyslog. d/haproxy. conf $ ModLoad imudp $ UDPServerRun 514 $ template Haproxy, "% rawmsg % \ n" local0.= info-/var/log/haproxy. Log; Haproxy local0.notice-/var/log/haproxy-status.log; Haproxy ### keep logs in localhost # local0 .*~ 4) The/etc/sysconfig/rsyslog content is as follows # Options for rsyslogd # Syslogd options are deprecated since rsyslog v3. # If you want to use them, switch to compatibility mode 2 by "-c 2" # See rsyslogd (8) for more details SYSLOGD_OPTIONS = "-c 2-r-m 0" remarks: #-c 2 uses the compatibility mode. the default value is-c 5 #-r. enable remote logs #-m 0 to mark the timestamp. The unit is minute. if it is 0, this function is disabled. the log configuration mainly involves these files. In addition, restart the rsyslog and haproxy services to run centos 6:/etc/init. d/rsyslog restart centos 7: systemctl restart rsyslog killlall-9 haproxy & haproxy-f/etc/haproxy. conf, make sure to enable the iptables udp 514 Port. iptables-I INPUT-m udp-p udp -- dport 514-j ACCEPT. Otherwise, a bunch of errors may be reported, similar to the following: sendto logger #0 failed: operation not permitted (errno = 1)