Hi,

In our design we have a GUI where operator can configure the IP and Port of the 
remote syslog server. Operator can enable or disable streaming to the 
configured IP and Port using a flag.


In the backend we will consume the configuration made by the operator and 
prepare the required configuration file to stream logs to the configured remote 
syslog server (Identified by IP and Port).


1) In the design i chose, I plan to have initial config files prefixed with '.' 
so that those config files will not be read by rsyslogd.

Example config file is enclosed below.

2) When operator configures the IP, Port, then a script will be invoked in the 
background which will update the initial set of lines that define the local 
variables. Say set $.IPADDRESS1 = ""; will be updated as set $.IPADDRESS1 = 
"10.10.100.200";

3) Config file updated will be saved without the '.' prefix. restarting rsyslod 
will/should apply the configuration (i.e., stream logs to remote syslog server 
10.10.100.200.


Example config file with 2 remote syslog servers for illustration purpose:

set $.IPADDRESS1 = "";
set $.IPADDRESS2 = "";
set $.PORTNUMBER1 = "";
set $.PORTNUMBER2 = "";

if ($syslogseverity-text == 'info')
then
{
 action(type="omfwd" Target="$.IPADDRESS1" Port="$.PORTNUMBER1" Protocol="udp" 
Template="ForwardFormat")
 action(type="omfwd" Target="$.IPADDRESS2" Port="$.PORTNUMBER2" Protocol="udp" 
Template="ForwardFormat")
 stop
}


Please guide me if the same can be achieved using alternate mechanisms.


thanks and regards

Lak.



________________________________
From: David Lang <[email protected]>
Sent: Tuesday, April 24, 2018 5:36 AM
To: putcha narayana via rsyslog
Cc: Rainer Gerhards; putcha narayana
Subject: Re: [rsyslog] Urgent, need help with correct usage of local variables 
in an action

target and port cannot be variables, variables can only be used where they are
explicitly allowed (almost entirely in templates)

let's back up a bit and ask what you are trying to do rather than why this
specific approach doesn't work.
_______________________________________________
rsyslog mailing list
http://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