Tag-Archive for » syslogd «

Haproxy在Freebsd下不能记录日志的问题

这几天给蹦心(bengxin.com) 开发环境配置haproxy,遇到的这个问题困扰了我一个晚上,google和baidu了N次也没有找到解决办法,最后自己通读了syslogd和syslog.conf以及haproxy的log相关的man pages,经过若干次的syslogd -d (debug) ,终于在debug日志里面发现了端倪,有这么一个东西导致了日志不能正确的记录到haproxy指定的日志文件里面:

validate: dgram from IP 127.0.0.1, port 49336, name localhost.bengxin.com;
rejected in rule 0 due to port mismatch.
rejected in rule 1 due to port mismatch.
rejected in rule 2 due to port mismatch.

于是给syslogd启动参数加入了下面的内容:

-a 127.0.0.1/32:* -a localhost:* -a 192.168.222.0/16:*

于是乎,期待了很久的haproxy日志出现了!

dev# tail -f /var/log/haproxy/haproxy_3.log
Aug 22 15:32:06 localhost haproxy[64136]: Proxy www started.
Aug 22 15:32:06 localhost haproxy[64136]: Proxy cherokee started.
Aug 22 15:32:06 localhost haproxy[64136]: Proxy wap started.
Aug 22 15:32:06 localhost haproxy[64136]: Proxy pic started.
Aug 22 15:32:06 localhost haproxy[64136]: Proxy img started.
Aug 22 15:32:06 localhost haproxy[64136]: Proxy public started.
Aug 22 15:32:06 localhost haproxy[64136]: Proxy public started.
Aug 22 15:32:59 localhost haproxy[64137]: 219.142.128.30:6416 [22/Aug/2009:15:32:59.754] public stats/ 0/-1/-1/-1/0 200 17329 – – PR– 0/0/0/0/0 0/0 “GET /?stats HTTP/1.1”
Aug 22 15:32:59 localhost haproxy[64137]: 219.142.128.30:6416 [22/Aug/2009:15:32:59.754] public stats/
0/-1/-1/-1/0 200 17329 – – PR– 0/0/0/0/0 0/0 “GET /?stats HTTP/1.1”

我的haproxy和日志相关的配置部分如下:

more »