Refining logging with syslog-ng

Hi,

I would like to use different logfiles to store different detailed activity reports. For an example : a file dedicated to a specific backend, another one for failed requests (error 500), …

We are using syslog-ng and I have only used simple filters with predefined macros so far.

But how could I use the values returned by HAProxy as macros in my filters ?

To filter 500 status code request, the best I have found so far is :

filter f_failed { message(" 500 "); };

but is is neither precise nor satisfying.

Is there a way to get something using HAPROXY.STATUS_CODE for an example ?

I’m not a syslog-ng expert, so I hope someone may have done something similar :slight_smile:

Regards