HAProxy Enterprise Documentation 2.0r1

Setting Log Levels

With HAProxy Enterprise you can easily define log levels for your proxies and servers. In addition to the logging configuration you define at the global or proxy level, you can define conditional log levels for individual requests and responses that match specific criteria.

What are log levels?

HAProxy log levels are the same as the severity levels used by the syslog service. HAProxy Enterprise tags each loggable event with a severity level. For example, it categorizes log messages related to connections and HTTP requests with the info severity level. Other events are categorized using one of the other, less verbose levels. From most to least important, the severity levels are:

Severity Level

HAProxy Logs


Errors such as running out of operating system file descriptors.


Some rare cases where something unexpected has happened, such as being unable to cache a response.


Not used.


Errors such as being unable to parse a map file, being unable to parse the HAProxy configuration file, and when an operation on a stick table fails.


Certain important, but non-critical, errors such as failing to set a request header or failing to connect to a DNS nameserver.


Changes to a server's state, such as being UP or DOWN or when a server is disabled. Other events at startup, such as starting proxies and loading modules, are also included. Health check logging, if enabled, also uses this level.


TCP connection and HTTP request details and errors.


You may write custom Lua code that logs at this level.

Setting global and default log levels

Including a log level in the global section establishes a definition that can be easily included in other sections using the log global declaration.

   log  local0            # access logs
   log  local1 notice     # administrative logs

   log global             #inserts global log def here

frontend www
   log global             #inserts global log def here

backend webservers
   log global             #inserts global log def here

Setting conditional log levels

To set the log level for individual requests or responses that match specified criteria, you can use these directives:

http-request set-log-level <level> [ { if | unless } <condition> ]

Change the log level of the current request when a certain condition is met.

http-response set-log-level <level> [ { if | unless } <condition> ]

Change the log level of the current response.

tcp-request content set-log-level <level> [ { if | unless } <condition> ]

Change the log level of the current session.

tcp-response content set-log-level <level> [ { if | unless } <condition> ]

Change the log level of the current session.

Using these directives, you can set the log level to any of the eight syslog levels or to the special level silent, which disables logging for this request/response. This rule is not final so the last matching rule wins.

Specify a condition using the syntax defined for ACLs.

You can promote interesting requests to error status to make sure you capture them:

frontend www
    bind :80
    acl failed_request status 400 401 403 404 405 408 429 500 503
    http-response set-log-level err if failed_request

See also

Next up

Logging without Waiting for Session Termination