Re: no logging with syslogd under FreeBSD

From: Willy Tarreau <w#1wt.eu>
Date: Fri, 11 Apr 2008 06:47:47 +0200


Hi Matthias,

On Thu, Apr 10, 2008 at 03:52:33PM +0200, Matthias Kellermann wrote:
> Hi all,
>
> I'm trying to get logging with syslogd on a FreeBSD test machine to
> work. This is my minimal sample config with haproxy-1.2.17:
>
> # cat /usr/local/etc/haproxy.conf
> global
> daemon
>
> log 127.0.0.1 syslog debug
>
> user www
> group www
>
> listen http_proxy 192.168.0.200:80
> mode http
> clitimeout 150000
> srvtimeout 30000
> contimeout 2000
> option forwardfor
> balance roundrobin
> server node1 192.168.0.201:80 check weight 3
> server node2 192.168.0.202:80 check weight 3
>
> syslogd is listening on the local machine:
>
> # sockstat -4 | grep syslogd
> root syslogd 17312 6 udp4 127.0.0.1:514 *:*
>
> syslog facility is going to /var/log/messages
>
> # grep syslog /etc/syslog.conf
> *.notice;authpriv.none;syslog.*;kern.debug;lpr.info;mail.crit;news.err
> /var/log/messages
>
> But haproxy won't log anything. Any ideas?

Looks rather strange. Could you try stracing syslogd and haproxy upon startup to check 1) if haproxy sends a log, and 2) if syslogd receives it ?

If you see syslogd receives the logs but does not write them, check that your syslogd is currently running with the above config (maybe a kill -HUP was forgotten after tweaking the config).

If haproxy does not emit anything, then try changing the address, or forcing the port (127.0.0.1:514), then try removing the level filter ("debug") and try changing the facility ("syslog") to something else (eg: local0).

You should see the lines indicating that haproxy has started.

Oh, BTW, I notice that you don't have any "log" statement in your listen section. You should add "log global", otherwise you will only get the process management logs ("starting" and "stopping"). Maybe you did not notice those and are just seeking for traffic logs, reason why you thought logging did not work ?

BTW, if your upstream client(s) do keep-alive, you will only get the first request in the logs. In this case, you'll have to add "option httpclose" in the listen section.

Hoping this helps,
willy Received on 2008/04/11 06:47

This archive was generated by hypermail 2.2.0 : 2008/04/11 07:00 CEST