Specified Backend Logging

Hi all!

I am working with HAProxy and have recently implemented http logging. I am now looking to see if it is possible to implement logging (at all levels: INFO, WARN, etc) only for a specific/defined backend. I have restricted logging only to the frontend serving this specified backend but due to the amount of other backends configured (several hundred), this has had limited effectiveness at reducing the amount of logging and the logs I need are getting ‘lost’ amongst the rest.

Is it possible to filter logs by their destination/source backend via HAProxy configuration or do I need to look into filtering them outside of HAProxy?

Thanks!

Unfortunately no, the log directive in the backend is only used for server up/down state transitions, while the frontend logging dictates the actual http logging.

http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-log

It is important to keep in mind that it is the frontend which decides what to
log from a connection, and that in case of content switching, the log entries
from the backend will be ignored. Connections are logged at level “info”.

However, backend log declaration define how and where servers status changes
will be logged. Level “notice” will be used to indicate a server going up,
“warning” will be used for termination signals and definitive service
termination, and “alert” will be used for when a server goes down.

I assume this is usually parsed at syslog level.

1 Like