ubuntu12.04 配置haproxy日誌

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.