5

How does one adjust logging level or disable logging altogether for specific backends in HAProxy?

In the example below, both directives "http-request set-log-level err" and "no log" seem to have no effect - the logs are swamped with lines of successful HTTP status 200 OK records.

global
  log /dev/log local0
  log /dev/log local1 notice

...

defaults
  log global
  mode http

  option httplog
  option dontlognull

...

backend static
  http-request set-log-level err
  no log
2
  • dontlognormal might do what you want. Can't be used in the backend section though.
    – wurtel
    Dec 8, 2014 at 10:35
  • @wurtel that's correct - option dontlog-normal cannot be set at the backend level and impacts all backends linked to a frontend with this option set. cbonte.github.io/haproxy-dconv/…
    – AlexMinza
    Dec 8, 2014 at 16:51

1 Answer 1

12

Courtesy of meineerde in #haproxy on Freenode:

You can disable logging in the frontend, using the same conditions by which you pick the backend.

http-request set-log-level silent if static
use_backend static                if static

This must happen in the frontend section, because the logging decision must be made at this stage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .