Configure Haproxy log support (rsyslog log Support)
System CentOS 6.x
Configure Haproxy log support
Cp/etc/rsyslog. conf/etc/rsyslog. conf 'date + % F'
Ll/etc/rsyslog. con *
Cat>/etc/rsyslog. conf <EOF
# Haproxy
Local0. */application/haproxy/logs/haproxy. log
# End
EOF
# Local0 should be specified in the haproxy configuration file, so select local0 here. The configuration of the following haproxy configuration file:
====================
Log 127.0.0.1: 514 local0 warning
# Global log configuration, log keyword, specify the local0 log Device in the syslog service using 127.0.0.1: 514, log level, Here select warning, generally do not use info
======================
# Modify/etc/sysconfig/rsyslog as follows:
[Root @ MASTER ~] # Tail-2/etc/sysconfig/rsyslog
# SYSLOGD_OPTIONS = "-c 5"
SYSLOGD_OPTIONS = "-c 2-m 0-r-x"
[Root @ MASTER ~] #
# Restart/etc/init. d/rsyslog
/Etc/init. d/rsyslog restart
#6.4 no port by default
Netstat-lntup
/Etc/init. d/rsyslog restart
######## Modify rsyslog. conf to display the port
Egrep 'udpserverrun | modload'/etc/rsyslog. conf
Sed-I's/# $ UDPServerRun 514/$ UDPServerRun 514/G'/etc/rsyslog. conf
Sed-I's/# $ ModLoad imudp/G'/etc/rsyslog. conf
Sed-n-e '/$ ModLoad imudp/p'-e'/$ UDPServerRun/P'/etc/rsyslog. conf
# Restart/etc/init. d/rsyslog
/Etc/init. d/rsyslog restart
Netstat-lntup | grep rsyslog
[Root @ MASTER ~] # Netstat-lntup | grep rsyslog
Udp 0 0 0.0.0.0: 514 0.0.0.0: * 5031/rsyslogd
Udp 0 0: 514: * 5031/rsyslogd
[Root @ MASTER ~] #
================================
[Root @ MASTER ~] # Cat/application/haproxy/logs/haproxy. log
Nov 6 10:58:49 127.0.0.1 haproxy [5049]: Stopping proxy test in 0 ms.
Nov 6 10:58:49 127.0.0.1 haproxy [5049]: Proxy test stopped (FE: 0 conns, BE: 0 conns ).
Nov 6 10:58:58 127.0.0.1 haproxy [5055]: Stopping proxy test in 0 ms.
Nov 6 10:58:58 127.0.0.1 haproxy [5055]: Proxy test stopped (FE: 0 conns, BE: 0 conns ).
[Root @ MASTER ~] #
### Note: If you still cannot record the log, disable selinux.
Haproxy + Keepalived build Weblogic high-availability server Load balancer Cluster
Keepalived + HAProxy configure high-availability Load Balancing
Haproxy + Keepalived + Apache configuration notes in CentOS 6.3
Haproxy + KeepAlived WEB Cluster on CentOS 6
Haproxy + Keepalived build high-availability Load Balancing
Configure an HTTP Load balancer using HAProxy
For details about HAproxy, click here
HAproxy: click here
This article permanently updates the link address: