Of you insist on using local variables, the answer is: no, this does not work.
Rainer Sent from phone, thus brief. putcha narayana via rsyslog <[email protected]> schrieb am Di., 24. Apr. 2018, 10:08: > Hi, > > > I am not requesting for script to update the config file. I have already > implemented that. I have attached the shell script and a sample config file. > > > I am seeking help w.r.t the config file with a provision to use local > variables so that they can be updated/configurable by user. > > > Thanks and Regards > > Lak. > > > ________________________________ > From: David Lang <[email protected]> > Sent: Tuesday, April 24, 2018 6:59 AM > To: putcha narayana > Cc: David Lang; putcha narayana via rsyslog > Subject: Re: [rsyslog] Urgent, need help with correct usage of local > variables in an action > > This cannot be done inside rsyslog, you would need to use some external > software > (puppet, chef, salt, ansible, or even just sed) to change the config file > and > then start/restart rsyslog > > On Tue, 24 Apr 2018, putcha narayana wrote: > > > Date: Tue, 24 Apr 2018 06:47:03 +0000 > > From: putcha narayana <[email protected]> > > To: David Lang <[email protected]>, > > putcha narayana via rsyslog <[email protected]> > > Subject: Re: [rsyslog] Urgent, > > need help with correct usage of local variables in an action > > > > 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. _______________________________________________ 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.

