Mailing List Archive

myhostname property
Group:

I admit I am scratching my head on this one, any help is appreciated.

This works in an output template…

property(name=“$myhostname”)

…but this does not work in a set statement…

set $!thishost = $myhostname;


I’d really like to bypass the set statement and just do this…

if ($myhostname == “hoststring”)

…but that doesn’t work either.


At least according to “rsyslogd -N5” it doesn’t work. Have I missed something fundamental?

Both 8.2004 and 8.2010 behave this way. When is a property not a property?

Thanks and regards,
_______________________________________________
rsyslog mailing list
https://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: myhostname property [ In reply to ]
On Tue, 12 Jan 2021, John Chivian via rsyslog wrote:

> I admit I am scratching my head on this one, any help is appreciated.
>
> This works in an output template…
>
> property(name=“$myhostname”)
>
> …but this does not work in a set statement…
>
> set $!thishost = $myhostname;

try

set $!thishost = $$myhostname;

for legacy reasons, some things need double $ when referenced like this. If the
properties page lists just a name, then $name works. If it lists $foo, then you
need to reference it as $$foo

David Lang
_______________________________________________
rsyslog mailing list
https://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.