HAProxy Logging Help

Discussion in 'HOWTO-Related Questions' started by asyadiqin, Jul 4, 2008.

  1. asyadiqin

    asyadiqin New Member

    I've installed HA-Proxy version 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
            log   local0
            log   local1 notice
            #log loghost    local0 info
            maxconn 4096
            user haproxy
            group haproxy
            log     global
            mode    http
            option  httplog
            option  dontlognull
            retries 3
            option redispatch
            maxconn 2000
            contimeout      5000
            clitimeout      50000
            srvtimeout      50000
    listen IK_WebFarm
           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 cookie A check
           server WEB-2 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.

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


    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.
  2. asyadiqin

    asyadiqin New Member

    Still waiting for someone to help me to sort out this logging issue....Anyone? Please? :D
  3. falko

    falko Super Moderator ISPConfig Developer

    I'm sorry, but I'm no rsyslog expert...
  4. asyadiqin

    asyadiqin New Member

    Anyone manage to successfully install HAProxy and Heartbeat on a Fedora server and manage to get the logging for HAProxy working?
  5. rodhom

    rodhom New Member

    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"

Share This Page