ubuntu12.04 配置haproxy日志

haproxy打开日志的方法(ubuntu 12.04)
一、修改haproxy.cfg配置:
global

        log 127.0.0.1    local3 err

        maxconn 4096

        daemon

        nbproc 1
/*
注:
log [max_level]
Connections are logged at level "info". Services initialization andservers
going up are logged at level "notice", termination signals are loggedat
"warning", and definitive service termination, as well as loss ofservers 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 beingemitted.
Example :
---------
global
log 192.168.2.200 local3
log 127.0.0.1 local4 notice
*/
二、在 /etc/rsyslog.conf

1、增加:local3.*/var/log/haproxy.log

2、放开注释

# provides UDP syslog reception

#$ModLoad imudp

#$UDPServerRun 514

 

更改为:

$ModLoad imudp

$UDPServerRun 514


三、核实services文件:(网上好多都说看这个,这个系统默认是打开的)
[root@linux ~]# grep 514 /etc/services
syslog 514/udp
#
特别特别注意,你的/etc/services里面必须要存在这一行才行
#
如果不存在这一行,你可以手动自行增加的!
四、修改rsyslog的启动设定档,通常在/etc/default/rsyslog
RSYSLOGD_OPTIONS="-c5"
改为:
RSYSLOGD_OPTIONS="-r -c 5"
五、重启syslog
[root@linux ~]# /etc/init.d/rsyslog restart

 

看到下面的信息说明rsyslogd已经监听udp 514端口了
[root@linux ~]# netstat -lunp
udp6      
0      0 :::514                  :::*                                30975/rsyslogd

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值