HAProxy does not log access logs

hi folks,
I have a weird behavior with my Haproxy. It logs haproxy startup but no access log

Here is the HAProxy configuration:

    defaults
        mode                    http
        log                     global
        option                  httplog
        timeout connect         5s
        timeout client          5s
        timeout server          5s
        errorfile 502 /etc/haproxy/erros/503.http
        errorfile 503 /etc/haproxy/erros/503.http 

    global
      log /dev/log local0 debug
      chroot      /var/lib/haproxy
      pidfile     /var/run/haproxy.pid
      maxconn     4000
      user        haproxy
      group       haproxy
      daemon

      # turn on stats unix socket
      stats socket /var/lib/haproxy/stats

    frontend front_service
      bind *:80
      log global
      default_backend front_pool
      
    backend front_pool
      balance roundrobin
      server server1 XXXXXX:80  
      server web2 XXXXXXX:80 

And here is the rsyslog configuration:

# Collect log with UDP
$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514

# Creating separate log files based on the severity
local0.* /var/log/haproxy-traffic.log
local0.notice /var/log/haproxy-admin.log

OS: RHEL8

Any help ? thanks in advance

Replace /dev/log with 127.0.0.1:514 if that’s where you want to log to. If you don’t see anything, tcpdump it:

tcpdump -i lo udp port 514

1 Like

thanks @lukastribus this works for me, but why reading log direcly from /dev/log does not work ?

/dev/log is a log device, not a file and a destination not a source. If haproxy sends log to /dev/log but your syslog server is listening for message somewhere else, you are not gonna get them.