sss_0412
sss_0412

Reputation: 3

Log only 4xx and 5xx HTTP response errors in HAPROXY 2.1

In HaProxy 2.1 version, I am trying to log only 4xx and 5xx errors.

Here's snippet of config file:

global
  log stdout local0

defaults
  log global
  option httplog
  option dontlognull
  option dontlog-normal
  mode http
  .
  .

When I use option dontlog-normal, it just logs 5xx errors and specific 403 errors restricted by ACL. With option log-separate-errors, it again just logs 5xx errors. But both option doesn't log any 404 and other 4x errors in the logs.

Is there any way to include both 5xx and 4xx in a dedicated error logfile ?

Thanks.

Upvotes: 0

Views: 1516

Answers (1)

Michał Politowski
Michał Politowski

Reputation: 4385

I think http-response set-log-level err if { status 400:499 } (see docs) should do for client errors the equivalent of what option log-separate-errors does for server/connection errors.

Upvotes: 1

Related Questions