PDA

View Full Version : HAProxy Logging Help


asyadiqin
4th July 2008, 16:19
I've installed HA-Proxy version 1.3.15.2 on a freshly installed Fedora Core 9 server. Everything seems to be working fine as far I can see from the Ha-Proxy stats.

However, I can't seem to locate the logs that HA-Proxy writes to. Below is the content of my /etc/haproxy/haproxy.cfg

global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#debug
#quiet
user haproxy
group haproxy

defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000

listen IK_WebFarm 10.1.1.2:80
mode http
stats enable
stats auth someuser:somepassword
balance source
cookie JSESSIONID prefix
option httpclose
option forwardfor
option httpchk HEAD /check.txt HTTP/1.0
server WEB-1 10.1.1.30:80 cookie A check
server WEB-2 10.1.1.31:80 cookie B check


I've googled for answers and there is a site that said something about HA-Proxy logging to a syslog facility local0 via a socket connection, which by default, in most syslog configuration, does not accept socket connections or doesn't have any local0 facility. There is instructions on how to fix this but it only applies to servers using syslogd, which FC no longer supports and now uses rsyslogd. I have no prior experience in configuring syslog or anything like that, so I would appreciate if someone can help me.


How do I configure rsyslogd to accept HA-Proxy logging
How do I configure HA-Proxy to write the logs to specific file and location, eg. /var/log/haproxy.log


UPDATE!

I've added the following to /etc/rsyslog.conf

# Save HA-Proxy logs
local0.* /var/log/haproxy_0.log
local1.* /var/log/haproxy_1.log


Now I can see the 2 log files when I restart rsyslogd, but nothing is being logged into those 2 files. Anyone have any idea how to sort this out? Thanks.

asyadiqin
9th July 2008, 15:44
Still waiting for someone to help me to sort out this logging issue....Anyone? Please? :D

falko
10th July 2008, 15:46
I'm sorry, but I'm no rsyslog expert...

asyadiqin
17th July 2008, 12:59
Anyone manage to successfully install HAProxy and Heartbeat on a Fedora server and manage to get the logging for HAProxy working?

rodhom
15th August 2008, 02:11
You just have to restart syslogd with -r option so it will accept connections:

* By default the syslog daemon doesn't accept any message from the
syslog/udp port. To enable this add "-r" to the command-line
arguments. You _have to_ add this on every host that should run as a
centralized network log server.


On CentOS 5 edit /etc/sysconfig/syslog adding this:

SYSLOGD_OPTIONS="-r -m 0"