1
我試圖讓HAProxy記錄tcp流量我一直在做的沒有成功。這裏是我的confs:HAProxy將只記錄啓動消息
/etc/haproxy/haproxy.cfg
global
log /var/lib/haproxy/dev/log local0 debug
chroot /var/lib/haproxy
maxconn 2000
user haproxy
group haproxy
defaults
log /var/lib/haproxy/dev/log local4 debug
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
timeout connect 5000
timeout client 10000
timeout server 10000
listen sco 0.0.0.0:80
log /var/lib/haproxy/dev/log local4 debug
mode tcp
stats enable
stats uri /haproxy?stats
balance roundrobin
cookie SERVERID insert indirect nocache
server test11 172.21.0.3:8888 check cookie test11
server test12 172.21.0.2:8888 check cookie test12
/etc/rsyslog.d/49-haproxy.conf
$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
local0.* -/var/log/haproxy/haproxy_0.log
local4.* -/var/log/haproxy/haproxy_4.log
if ($programname == 'haproxy') then -/var/log/haproxy/haproxy.log
& ~
我得到的輸出只是代理啓動線。
/var/log/haproxy/haproxy.log
Mar 31 18:23:19 74f09d6f9f70 haproxy[27]: Proxy sco started.
/var/log/haproxy/haproxy_4.log
Mar 31 18:23:19 74f09d6f9f70 haproxy[27]: Proxy sco started.
我產生一些流量。 HAProxy正確重定向它,但不會記錄任何內容。我不知道發生了什麼。
我配置rsyslog現在在該文件中寫的,不是HAProxy的 –