问题
Good evening,
I'm using HAProxy (ver 1.4.24) as a load balancer for ~3000 requests per second. I am trying to log only 5xx responses, but I am unable to achive that. I am using the following configuration:
http://pastebin.com/TsTk9GQE
This configuration also logs 2xx requests, as long as 5xx and 4xx. I need only 5xx and 4xx, or just 5xx.
Thanks,
回答1:
There is an option called "dontlog-normal" in HAProxy to log only errors (whatever type of errors).
Just enable it in your defaults section. Note in HAProxy 1.5, you have a new http-request set-log-level that you could use to disable logging when the status code is 2xx. This can simply be triggered by ACLs.
Baptiste
来源:https://stackoverflow.com/questions/23174291/haproxy-1-4-dont-log-2xx-only-log-5xx