使用 socat 解决 HAProxy BADREQ

使用 socat 解决 HAProxy BADREQ

我试图通过在 socat 中使用“show errors”来弄清楚为什么我会不时收到 BADREQ。问题是它只显示最后一个错误。我希望能够看到所有错误(例如使用 tail -f ... | grep something)。

有人能告诉我如何才能持续显示这些 BADREQ 吗?使用还是不使用 socat?

真正的问题是我在 haproxy 日志中收到 BADREQ,但 [echo "show errors" | socat unix-connect:/var/run/haproxy.sock stdio] 没有捕获它们。这与 haproxy 配置有关吗?

答案1

由于显示错误定义为:

show errors : report last request and response errors for each proxy

我认为你可能运气不佳。但是,使用一些 shell 脚本,你应该能够在一个文件中收集足够多的信息,以便查明真相:

#Run the command every 10 seconds, appending to the errors file in the current directory
nohup bash -c 'while true; do echo "show errors" | socat stdio /var/run/haproxy-t1.stat; sleep 10; done >> errors'

答案2

也许计数器的增加意味着没有真正的“坏请求”,但像端口扫描这样的事情,正如在https://serverfault.com/a/202654/227214

我还注意到 badreq-counters 有所增加,但在“显示错误”中没有匹配的条目。

相关内容