[rsyslog-notify] Forum Thread: Separate messages by groups of servers - (Mode 'post')

noreply at adiscon.com noreply at adiscon.com
Wed Aug 31 23:58:29 CEST 2016


User: mtovey 
Forumlink: http://kb.monitorware.com/viewtopic.php?p=26922#p26922

Message: 
----------
I need to direct messages based upon what group a server is a member of.  I
want to load a variable with a list of servers, and then if a message
arrives from a server that is a member of that group, the message is
directed to the appropriate file for that group.  Conceptually, this is
what I have in mind:

set $host_group1 = 'server1 server2 server3';

if ($host_group1 contains $hostname) then {

*.*                                                   
-/opt/logs/host_group1/messages

}

If I replace '$host_group1' in the 'if' expression with the string 'server1
server2 server3', then it works perfectly.  But I would rather do it
through a variable set at the top of the file because there could be
several of these expressions in the configuration file and I would like to
define the server list only once instead of everywhere that an expression
is defined.  Can this be done?
I am running Rsyslog 7.4.7 on OEL 7.2


More information about the rsyslog-notify mailing list