Hello Rainer,

I shared an example of the mechanism i planned to employ. I understand that my 
mechanism cannot be achieved with the current rsyslogd. There is no hard and 
fast rule to only use the mechanism i shared.


I will be happy to employ an alternate working mechanism. Now that my end goal 
is clear, please share some example for the alternate methods, i will employ 
them.


Appreciate your help.


Thanks and Regards

Lak.


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

Well, there are ways to do this, just not like you want ;-)

Environment variables and files is the way to go.

Rainer

Sent from phone, thus brief.

putcha narayana <[email protected]<mailto:[email protected]>> 
schrieb am Di., 24. Apr. 2018, 10:32:

I believe it will be a good useful feature to allow users to define 
local/global variables so that update in individual conf file or one place 
update of global variables will enable configuring the external server IP and 
Port.


I plan to use a static IP in the .66-MgmtMsgsLogging.conf.

When IP and Port are updated then using the script i will replace them.

When enable option is given then the comment in front of action will be removed.

To disable add the # back.


#action(type="omfwd" Target="10.10.10.10" Port="0" Protocol="udp" 
Template="ForwardFormat")
#action(type="omfwd" Target="11.11.11.11" Port="0" Protocol="udp" 
Template="ForwardFormat")


Thanks and Regards

Lak.





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

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]<mailto:[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]<mailto:[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]<mailto:[email protected]>>
> To: David Lang <[email protected]<mailto:[email protected]>>,
>     putcha narayana via rsyslog 
> <[email protected]<mailto:[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]<mailto:[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.

Reply via email to