Skip to main content

HAProxy

Installation

# RedHat 8.3
yum install haproxy

Setting Up HAProxy Logging

The default configuration points to the localhost (127.0.0.1) and local2 is the default facility code used to identify HAProxy log messages under rsyslog.

/etc/rsyslog.d/haproxy.conf

$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
local2.*        /var/log/haproxy/haproxy-traffic.log
local2.notice   /var/log/haproxy/haproxy-admin.log

Create the directories required

mkdir /var/log/haproxy
chown haproxy.haproxy /var/log/haproxy

Restart the rsyslog

systemctl restart rsyslog

Configuring HAProxy

Edit the file /etc/haproxy/haproxy.cfg .

HAProxy Stats page

listen stats
    bind *:9000
    stats enable
    stats hide-version
    stats uri /stats
    stats admin if LOCALHOST
    stats auth haproxy:Lostp@1ss