HAProxy Enterprise Documentation 2.5r1

Enabling Logging

To enable logging in HAProxy Enterprise, follow these steps:

  1. Add a log line to the global section in your configuration file. The following lines configure the access (frontend traffic) log on the syslog local0 facility and the admin (backend server status) log on the syslog local1 facility.

    global
       # log all events to a remote syslog server
       log 127.0.0.1 local0
    
       # log 'notice' level events and above to a remote syslog server
       log 127.0.0.1 local1 notice

    The log directive takes the following parameters:

    • the IP address of your syslog server or the path to a local syslog UNIX socket (i.e. /dev/log)

    • an optional len <length>, which changes the default length of 1024 characters per log line

    • an optional format <format>, which you can set to rfc3164 (default), rfc5424, short, or raw

    • an optional sample <range>:<size> to capture a sample of the logs (i.e. 1 out of 3 would be sample 1:3)

    • the facility code (usually local0 or, if that is already used, local1)

    • the level of severity; choose one of emerg, alert, crit, err, warning, notice, info, or debug. Omit severity to log all events.

  2. In your frontend or defaults section, add a log global directive, which uses the settings you defined with the log directive in the global section.

    defaults
       log global

Next up

Setting Log Levels