Mailing List Archive

using backticks with echo or cat for target ip?
Hi,

I am trying to have config that does not have the target ip for omfwd
hardcoded (although I probably need to restart the service everytime I want
it to send to a new ip).
I though i could achieve this with backticks.

target=`echo $target` or target=`cat target.txt`

but both appear not to work.
In case of the variable, I used "export target=10.0.0.2". rsyslogd -N1 does
not complain about anything, but service rsyslog status tells me that it
cannot resolve hostname "": No such file or directory.

In case of the file, it does complain by saying that the target parameter
contains whitespace. But the content of the file is only "10.0.0.2". Nothing
more, not even a new line.

I read in some older post, that some parameter like target can not use
backtick variables. Is this still valid? I'm running 8.2001.0

Thanks!



--
Sent from: http://rsyslog-users.1305293.n2.nabble.com/
_______________________________________________
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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
no, the target cannot be a variable.

David Lang

On Thu, 20 Feb 2020, Arp via rsyslog wrote:

> Date: Thu, 20 Feb 2020 09:41:27 -0700 (MST)
> From: Arp via rsyslog <rsyslog@lists.adiscon.com>
> To: rsyslog@lists.adiscon.com
> Cc: Arp <arpad@miskolczi.de>
> Subject: [rsyslog] using backticks with echo or cat for target ip?
>
> Hi,
>
> I am trying to have config that does not have the target ip for omfwd
> hardcoded (although I probably need to restart the service everytime I want
> it to send to a new ip).
> I though i could achieve this with backticks.
>
> target=`echo $target` or target=`cat target.txt`
>
> but both appear not to work.
> In case of the variable, I used "export target=10.0.0.2". rsyslogd -N1 does
> not complain about anything, but service rsyslog status tells me that it
> cannot resolve hostname "": No such file or directory.
>
> In case of the file, it does complain by saying that the target parameter
> contains whitespace. But the content of the file is only "10.0.0.2". Nothing
> more, not even a new line.
>
> I read in some older post, that some parameter like target can not use
> backtick variables. Is this still valid? I'm running 8.2001.0
>
> Thanks!
>
>
>
> --
> Sent from: http://rsyslog-users.1305293.n2.nabble.com/
> _______________________________________________
> 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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
What are you trying to overcome/achieve.
Perhaps using a hostname rather than IP address would help you.
You could define the hostname and IP in /etc/hosts. This would not
require restarting rsyslog when it changes.
You might otherwise consider using a DynamicDNS server to resolve the
address.

On 2/20/20 2:04 PM, David Lang via rsyslog wrote:
> no, the target cannot be a variable.
> David Lang
>
>> Date: Thu, 20 Feb 2020 09:41:27 -0700 (MST)
>> From: Arp via rsyslog <rsyslog@lists.adiscon.com>
>> Cc: Arp <arpad@miskolczi.de>
>>
>> I am trying to have config that does not have the target ip for omfwd
>> hardcoded (although I probably need to restart the service everytime
>> I want
>> it to send to a new ip).
>> ...
_______________________________________________
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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
Actually, I forward to two seperate machines, and want the ability to
stop forwarding whenever I want. So I thought, that if I put the ip's of
the receivers into files, and want to stop one, I just change the ip in
the file without changing the config file itself.

Am 20.02.20 um 21:28 schrieb dgermanrsysl--- via rsyslog:
> What are you trying to overcome/achieve.
> Perhaps using a hostname rather than IP address would help you.
> You could define the hostname and IP in /etc/hosts. This would not
> require restarting rsyslog when it changes.
> You might otherwise consider using a DynamicDNS server to resolve the
> address.
>
> On 2/20/20 2:04 PM, David Lang via rsyslog wrote:
>> no, the target cannot be a variable.
>> David Lang
>>
>>> Date: Thu, 20 Feb 2020 09:41:27 -0700 (MST)
>>> From: Arp via rsyslog <rsyslog@lists.adiscon.com>
>>> Cc: Arp <arpad@miskolczi.de>
>>>
>>> I am trying to have config that does not have the target ip for omfwd
>>> hardcoded (although I probably need to restart the service everytime
>>> I want
>>> it to send to a new ip).
>>> ...
> _______________________________________________
> 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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
the only thing that rsyslog can change without a restart is to use table_lookup
(with it's ability to reload the table)

everything else, including using environment variables, ould requre a restart
when it changes. Even DNS lookups need to be cached to some extent to avoid
insane numbers of lookups to DNS servers.

David Lang

On Thu, 20 Feb 2020, Arpad Miskolczi
via rsyslog wrote:

> Date: Thu, 20 Feb 2020 23:36:39 +0100
> From: Arpad Miskolczi via rsyslog <rsyslog@lists.adiscon.com>
> To: rsyslog@lists.adiscon.com
> Cc: Arpad Miskolczi <arpad@miskolczi.de>
> Subject: Re: [rsyslog] using backticks with echo or cat for target ip?
>
> Actually, I forward to two seperate machines, and want the ability to stop
> forwarding whenever I want. So I thought, that if I put the ip's of the
> receivers into files, and want to stop one, I just change the ip in the file
> without changing the config file itself.
>
> Am 20.02.20 um 21:28 schrieb dgermanrsysl--- via rsyslog:
>> What are you trying to overcome/achieve.
>> Perhaps using a hostname rather than IP address would help you.
>> You could define the hostname and IP in /etc/hosts. This would not require
>> restarting rsyslog when it changes.
>> You might otherwise consider using a DynamicDNS server to resolve the
>> address.
>>
>> On 2/20/20 2:04 PM, David Lang via rsyslog wrote:
>>> no, the target cannot be a variable.
>>> David Lang
>>>
>>>> Date: Thu, 20 Feb 2020 09:41:27 -0700 (MST)
>>>> From: Arp via rsyslog <rsyslog@lists.adiscon.com>
>>>> Cc: Arp <arpad@miskolczi.de>
>>>>
>>>> I am trying to have config that does not have the target ip for omfwd
>>>> hardcoded (although I probably need to restart the service everytime I
>>>> want
>>>> it to send to a new ip).
>>>> ...
>> _______________________________________________
>> 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.
>
_______________________________________________
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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
There is a setting "action.externalstate.file", which permits you to
suspend/enable actions via an external file. I guess this could be
what you actually want. I just discovered that the setting is not
documented, so its probably time to ensure it will be.

Does that sound right?

Rainer

El jue., 20 feb. 2020 a las 21:28, dgermanrsysl--- via rsyslog
(<rsyslog@lists.adiscon.com>) escribió:
>
> What are you trying to overcome/achieve.
> Perhaps using a hostname rather than IP address would help you.
> You could define the hostname and IP in /etc/hosts. This would not
> require restarting rsyslog when it changes.
> You might otherwise consider using a DynamicDNS server to resolve the
> address.
>
> On 2/20/20 2:04 PM, David Lang via rsyslog wrote:
> > no, the target cannot be a variable.
> > David Lang
> >
> >> Date: Thu, 20 Feb 2020 09:41:27 -0700 (MST)
> >> From: Arp via rsyslog <rsyslog@lists.adiscon.com>
> >> Cc: Arp <arpad@miskolczi.de>
> >>
> >> I am trying to have config that does not have the target ip for omfwd
> >> hardcoded (although I probably need to restart the service everytime
> >> I want
> >> it to send to a new ip).
> >> ...
> _______________________________________________
> 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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
That sounds like it would achieve my goal.

Does that file only need to exist, or does it contain something like
"enable" or "disable"?



--
Sent from: http://rsyslog-users.1305293.n2.nabble.com/
_______________________________________________
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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
I'll dig it out.

El vie., 21 feb. 2020 a las 9:12, Arp via rsyslog
(<rsyslog@lists.adiscon.com>) escribió:
>
> That sounds like it would achieve my goal.
>
> Does that file only need to exist, or does it contain something like
> "enable" or "disable"?
>
>
>
> --
> Sent from: http://rsyslog-users.1305293.n2.nabble.com/
> _______________________________________________
> 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.
Re: using backticks with echo or cat for target ip? [ In reply to ]
I had a look at the source code on github:D

If the file contains "SUSPENDED" the action is suspended, otherwise it runs
normally.
Thanks!

I think it would be even better (for me) to have the option to also disable
queueing if the statefile contains suspended, or something else. So that
there would be a difference in manually interrupting forwarding, or
suspension because the target is not available.
But I don't see that this is possible in the current state.



--
Sent from: http://rsyslog-users.1305293.n2.nabble.com/
_______________________________________________
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.