Disable HTTP logging for specific backend in HAProxy
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
Solution 1:
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.