2

I am enabling stats with something similar to this configuration:

global
  log /var/run/log local0 info

defaults
  log global

listen stats
  bind *:9090
  stats enable
  stats auth secret:pass
  stats refresh 5s
  stats show-legends
  stats show-node
  stats uri /stats

They work but now I would like to know if there is a way to preventing the stats to emit logs, currently, In my logs, I have multiple lines like:

Connect from x.x.x.x:33970 to y.y.y.y:9090 (stats/HTTP)

Any idea of how to prevent to log the stats requests?

I already tried in the listen stats definitions without success:

 http-request set-log-level silent
nbari
  • 558
  • 1
  • 9
  • 28
  • Related: [Disable HTTP logging for specific backend in HAProxy](https://serverfault.com/a/660034/505837) – Freddy Feb 23 '19 at 16:33
  • @Freddy like mentioned tried already but not working for the `listen` stats endpoint – nbari Feb 23 '19 at 16:34
  • maybe the only thing missing from this was configuration for http-request acl was the condition - "http-request set-log-level silent if TRUE" – Parth Patel Feb 11 '21 at 08:28

1 Answers1

0

I use option dontlog-normal in the frontend config - http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#4-option%20dontlog-normal and got no more log entries for /stats

frontend stats
     bind *:8404
     # Enable Prometheus Exporter
     http-request use-service prometheus-exporter if { path /metrics }
     stats enable
     stats uri /stats
     stats refresh 10s
     option dontlog-normal
  • FYI for future peeps, this did not work for me on HAProxy 1.8.23. Maybe it works for V2.0+ I had to add "http-request set-log-level silent if TRUE" to the frontend for stats inspired from the answer here: https://serverfault.com/a/660034/457984 – Parth Patel Feb 11 '21 at 08:25