|
System CentOS 6.x
Configure logging support Haproxy
cp /etc/rsyslog.conf /etc/rsyslog.conf`date +% F`
ll /etc/rsyslog.con*
cat >> /etc/rsyslog.conf<
#haproxy
local0. * /application/haproxy/logs/haproxy.log
#end
EOF
## Should be specified in the configuration file is haproxy local0, so here choose local0. The following configuration haproxy corresponding configuration file:
===============
log 127.0.0.1:514 local0 warning
## Global logging configuration ,, log keyword specifies the syslog 127.0.0.1:514 Service local0 log level, where the choice is warning, do not use general info
================
# Modify / etc / sysconfig / rsyslog reads as follows:
[Root @ MASTER ~] # tail -2 / etc / sysconfig / rsyslog
#SYSLOGD_OPTIONS = "- C 5"
SYSLOGD_OPTIONS = "- c 2 -m 0 -r -x"
[Root @ MASTER ~] #
# Reboot /etc/init.d/rsyslog
/etc/init.d/rsyslog restart
# 6.4 is not the default port
netstat -lntup
/etc/init.d/rsyslog restart
######## Rsyslog.conf allowed to modify appears port
egrep 'UDPServerRun | ModLoad' /etc/rsyslog.conf
sed -i 's / # $ UDPServerRun 514 / $ UDPServerRun 514 / g' /etc/rsyslog.conf
sed -i 's / # $ ModLoad imudp / $ ModLoad imudp / g' /etc/rsyslog.conf
sed -n -e '/ $ ModLoad imudp / p' -e '/ $ UDPServerRun / p' /etc/rsyslog.conf
# Reboot /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 that if you still can not log, remember to turn off selinux |
|
|
|