How to config haproxy.cfg and syslogd.conf or any other on OpenBSD for making haproxy's logs well done


#1

I have install the haproxy ver1.5.14 on OpenBSD 5.8 ,but i can not find the logs of haproxy anywhere even try to make any cofigurations for it,
i thik the logging must not be working with any reasons, then i was wondering how to do.
Thinks for any help.


#2

I am having the same problem on RHEL 6. If someone could point me in the right direction on how to configure it, I would be very grateful. I have followed some documentation on how to configure it for CentOS6.5. Basically it involves creating a conf file in rsyslog.d for haproxy. also a logrotate file as well.

I am not sure where my configuration has gone wrong. As nothing on RHEL 6 uses syslog anymore. So I don’t know where else haproxy would be logging and this configuration doesn’t create the files in /var/log.

/etc/haproxy/haproxy.cfg:
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the ‘-r’ option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local0
maxconn 4000
user haproxy
group haproxy

/etc/rsyslog.d/haproxy.conf
$ModLoad imudp
$UDPServerRun 514
$template Haproxy,"%msg%\n"
local0.=info -/var/log/haproxy.log;Haproxy
local0.notice -/var/log/haproxy-status.log;Haproxy

keep logs in localhost

local0.* ~

/etc/logrotate.d/haproxy
/var/log/haproxy.log {
daily
rotate 10
missingok
notifempty
compress
sharedscripts
postrotate
/bin/kill -HUP cat /var/run/syslogd.pid 2> /dev/null 2> /dev/null || true
/bin/kill -HUP cat /var/run/rsyslogd.pid 2> /dev/null 2> /dev/null || true
endscript
}