Hello !

 

On a centos 7, I got haproxy. I would like to split the logs from haproxy to 
different log files. So in /etc/rsyslog.d, I have created the following:

 

# Collect log with UDP

$ModLoad imudp

$UDPServerAddress 127.0.0.1

$UDPServerRun 514

 

# Creating separate log files based on the severity

local0.notice /var/log/haproxy-admin.log

& stop

if $programname == 'haproxy' and $msg contains "~ http_back/" then 
/var/log/haproxy/wp1.log

& stop

local0.* /var/log/haproxy-traffic.log

& stop

 

 

I should so get 3 differents files:
haproxy-admin.log with all notice messages
wp1.log with all messages containing ‘http_back’ in it
haproxy-traffic with the rest of messages
 

But I only get the first and the third one. I guess that there is a mistake in 
the line:

if $programname == 'haproxy' and $msg contains "~ http_back/" then 
/var/log/haproxy/wp1.log

 

I am not so familiar with rsyslog (that’s the first time I am trying to do such 
a thing) so I do not know how I could check the content of the 2 variables: 
$programname and $msg.

Any advice on that?

 

Thx in advance!

Lydie

_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to