Stop logging to journalctl

Hello, I’m on v1.8, I want to stop logging the details to journalctl, but keep /var/log/haproxy.log

log /dev/log local2

retries 3
timeout queue 1m
timeout connect 5s
timeout client 10s
timeout server 10s
timeout http-keep-alive 10s
timeout check 5s
log global

listen stats
mode http
stats enable
stats uri /stats
stats refresh 5s
stats auth wsadmin:101Ram
stats admin if LOCALHOST

option dontlog-normal

frontend devldap
mode tcp
option tcplog
default_backend devldap_backend

backend devldap_backend
mode tcp
balance roundrobin
option log-health-checks

    server devldap_390_1 check observe layer4 error-limit 10 on-error mark-down
    server devldap_390_2 check observe layer4 error-limit 10 on-error mark-down

Set the log to other path different than /dev/log like for example /dev/halog and use rsyslog, for example, to listen there and write the content to /var/log/haproxy.log

1 Like


we used to do this with rsyslog.

In haproxy.conf, configure the path where the logs are sent. In global section we have (be careful as it may be a chrooted path):

    log         /log  local2

    chroot      /var/lib/haproxy

After we use rsyslog. You have to create the log file as socket file, then configure rsyslog as usual to send the logs where you want :

# Create an additional socket in haproxy's chroot in order to allow logging via
# /dev/log to chroot'ed HAProxy processes
$AddUnixListenSocket /var/lib/haproxy/log

$template message_only,"%msg%\n"

# Send HAProxy messages to a dedicated logfile
if $programname startswith 'haproxy' then /var/log/haproxy.log;message_only
#& -?haproxy_by_minute;message_only
& stop

Restart rsyslog then restart haproxy and you should be able to get your logs in the right file

1 Like