Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1061087
  • 博文数量: 321
  • 博客积分: 7872
  • 博客等级: 少将
  • 技术积分: 2120
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-16 09:06
文章分类

全部博文(321)

文章存档

2017年(1)

2016年(1)

2015年(12)

2014年(17)

2013年(78)

2012年(15)

2011年(17)

2010年(67)

2009年(102)

2008年(11)

分类: LINUX

2009-04-29 18:13:04

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
阅读(1663) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~