§2024-06-05

Step 1: Configure HAProxy

Ensure your /etc/haproxy/haproxy.cfg has the correct log directives. It looks like you already have the following configuration in place:

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

¶ Step 2 install syslog-ng

sudo apt-get update
sudo apt-get install syslog-ng

 cp -v /etc/syslog-ng/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf.backup
'/etc/syslog-ng/syslog-ng.conf' -> '/etc/syslog-ng/syslog-ng.conf.backup'

source s_local { unix-stream("/dev/log"); };

destination d_haproxy_local0 { file("/var/log/haproxy-local0.log"); };

destination d_haproxy_local1 { file("/var/log/haproxy-local1.log"); };

filter f_local0 { facility(local0); };

filter f_local1 { facility(local1); };

log { source(s_local); filter(f_local0); destination(d_haproxy_local0); };

log { source(s_local); filter(f_local1); destination(d_haproxy_local1); };