HAProxy 1.4 - Don't log 2xx, only log 5xx

柔情痞子 提交于 2020-01-14 02:22:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!