Haproxy.cfg 1.5.12 log file error

haproxy

This is the top three lines of my haproxy.cfg:

global
    log /dev/log    local0
    log /dev/log    local1 notice
...

I get the error in the terminal:

root@b323d0a11c98:/etc# service haproxy start  
 * Starting haproxy haproxy
[ALERT] 122/190328 (1278) : sendto logger #1 failed: No such file or directory (errno=2)
[ALERT] 122/190328 (1278) : sendto logger #2 failed: No such file or directory (errno=2)
[ALERT] 122/190328 (1278) : sendto logger #1 failed: No such file or directory (errno=2)
[ALERT] 122/190328 (1278) : sendto logger #2 failed: No such file or directory (errno=2)

The directory /dev/log does not exist, is it just to create it and in that case which permissions does it need?

Best Answer

The actual log socket file should be created by your logging daemon, be it rsyslogd or syslog-ng or any other. There's a few things you need to keep in mind:

  1. haproxy only communicates with datagram sockets and not with stream sockets (default in some logging daemons), so consult the manual of the logging daemon on this
  2. if you use chroot beware that the log socket should be reachable from within the chroot

Another option could be to use the UDP service that most logging daemons also provide, so instead of a logging socket file you use 127.0.0.1