haproxy打开日志的方法(SuSE 10):
一、修改haproxy.cfg配置:
defaults
log global
mode http
option httplog
option dontlognull
log 127.0.0.1 local3 err
/*
注:
log [max_level]
Connections are logged at level "info". Services initialization and servers
going up are logged at level "notice", termination signals are logged at
"warning", and definitive service termination, as well as loss of servers are
logged at level "alert". The optional parameter specifies above
what level messages should be sent. Level can take one of these 8 values :
emerg, alert, crit, err, warning, notice, info, debug
For backwards compatibility with versions 1.1.16 and earlier, the default level
value is "debug" if not specified.
Permitted facilities are :
kern, user, mail, daemon, auth, syslog, lpr, news,
uucp, cron, auth2, ftp, ntp, audit, alert, cron2,
local0, local1, local2, local3, local4, local5, local6, local7
According to RFC3164, messages are truncated to 1024 bytes before being emitted.
Example :
---------
global
log 192.168.2.200 local3
log 127.0.0.1 local4 notice
*/
二、在 /etc/syslog.conf中增加:
local3.* /var/log/haproxy.log
三、核实services文件:
[root@linux ~]# grep 514 /etc/services
syslog 514/udp
#特别特别注意,你的/etc/services里面必须要存在这一行才行
#如果不存在这一行,你可以手动自行增加的!
四、修改syslogd的启动设定档,通常在/etc/sysconfig/syslog内
SYSLOGD_PARAMS=""
改为:
SYSLOGD_PARAMS="-r"
SYSLOG_DAEMON="syslog-ng"
改为:
SYSLOG_DAEMON="syslogd"
五、重启syslog
[root@linux ~]# /etc/init.d/syslog restart
[root@linux ~]# netstat -tlunp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:514 0.0.0.0:* 24314/syslogd