Configure haproxy logs in centos
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: loglocalhostlocal02)/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 /*. conf3)/etc/rsyslog. d/haproxy. conf // This file needs to be created manually. The content is as follows: cat/etc/rsyslog. d/haproxy. conf $ ModLoadimudp $ UDPServerRun514 $ templateHaproxy, "% rawmsg % \ n" local0.= info-/var/log/haproxy. log; Haproxylocal0.notice-/v Ar/log/haproxy-status.log; Haproxy ### keeplogsinlocalhost ## local0 .*~ 4)/etc/sysconfig/rsyslog content is as follows # Optionsforrsyslogd # feature # Ifyouwanttousethem, role "-c2" # Seersyslogd (8) formoredetailsSYSLOGD_OPTIONS = "-c2-r-m0" Remarks: #-c2 adopts the compatibility mode. The default value is-c5 #-r to enable remote logs #-m0 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 enable centos6:/etc/init. d/rsyslogrestartcentos7: systemctlrestartrsyslogkilllall-9haproxy & haproxy-f/etc/haproxy. conf Finally, the most important point, be sure to open the iptablesudp514 port iptables-IINPUT-mudp-pudp -- dport514-jACCEPT otherwise there may be a bunch of errors, like the following: sendtologger #0 failed: operationnotpermitted (errno = 1)