HAProxy 1.4-不记录2xx,仅记录5xx [英] HAProxy 1.4 - Don't log 2xx, only log 5xx

查看:113
本文介绍了HAProxy 1.4-不记录2xx,仅记录5xx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好

我将HAProxy(版本1.4.24)用作负载平衡器,每秒可处理约3000个请求.我仅尝试记录5xx响应,但无法实现.我正在使用以下配置:

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

此配置还会记录2xx请求,以及5xx和4xx.我只需要5xx和4xx,或者只需要5xx.

This configuration also logs 2xx requests, as long as 5xx and 4xx. I need only 5xx and 4xx, or just 5xx.

谢谢

推荐答案

HAProxy中有一个名为"dontlog-normal"的选项,用于仅记录错误(无论哪种错误).

There is an option called "dontlog-normal" in HAProxy to log only errors (whatever type of errors).

只需在您的默认值部分中启用它即可. 请注意,在HAProxy 1.5中,您有一个新的http-request set-log-level,可用于在状态代码为2xx时禁用日志记录.这可以简单地由ACL触发.

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.

洗礼池

这篇关于HAProxy 1.4-不记录2xx,仅记录5xx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆