Konfigurasi Haproxy

global
   log  127.0.0.1:514 local2

Konfigurasi rsyslog

# /etc/rsyslog.d/haproxy.conf

# Load module untuk menerima log dari UDP (port 514)
module(load="imudp")
input(type="imudp" port="514")

# Load module untuk menerima log dari TCP (port 514)
module(load="imtcp")
input(type="imtcp" port="514")

# Menyimpan log dari HAProxy ke file terpisah
#if $programname == 'haproxy' then /var/log/haproxy.log
#& stop

if $programname == 'haproxy' and $syslogfacility-text == 'local2' and $msg contains 'error' then /var/log/haproxy_error.log
if $programname == 'haproxy' and $syslogfacility-text == 'local2' and $msg contains 'error' then stop
if $programname == 'haproxy' and $syslogfacility-text == 'local2' then /var/log/haproxy_access.log
if $programname == 'haproxy' and $syslogfacility-text == 'local2' then stop

Leave a Reply

Your email address will not be published. Required fields are marked *