Mailing List Archive

set myhostname property value into local variable
Configuration with lines:
# set local variables
set $.localip = "1.1.1.1";
set $.host = $myhostname;

seems not be working. Getting these errors.

Jul 23 14:25:41 HOST-LOCO rsyslogd[6024]: rsyslogd: error during parsing
file /etc/rsyslog.d/global/09-variables.conf, on or before line 3: invalid
property 'myhostname' [v8.1901.0 try https://www.rsyslog.com/e/2207 ]
Jul 23 14:25:41 HOST-LOCO rsyslogd[6024]: rsyslogd: error during parsing
file /etc/rsyslog.d/global/09-variables.conf, on or before line 3: did you
mean '$myhostname' instead of 'myhostname'? See also:
https://www.rsyslog.com/rsyslog-info-1/ [v8.1901.0 try
https://www.rsyslog.com/e/2207 ]

Running rsyslog version 8.1901.0-1 on clean Debian 10 installation.
What's wrong here?

--
Peter
_______________________________________________
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: set myhostname property value into local variable [ In reply to ]
Try with quotes...

set $.host = "$myhostname";


On 7/23/19 9:30 AM, Peter Viskup via rsyslog wrote:
> Configuration with lines:
> # set local variables
> set $.localip = "1.1.1.1";
> set $.host = $myhostname;
>
> seems not be working. Getting these errors.
>
> Jul 23 14:25:41 HOST-LOCO rsyslogd[6024]: rsyslogd: error during parsing
> file /etc/rsyslog.d/global/09-variables.conf, on or before line 3: invalid
> property 'myhostname' [v8.1901.0 try https://www.rsyslog.com/e/2207 ]
> Jul 23 14:25:41 HOST-LOCO rsyslogd[6024]: rsyslogd: error during parsing
> file /etc/rsyslog.d/global/09-variables.conf, on or before line 3: did you
> mean '$myhostname' instead of 'myhostname'? See also:
> https://www.rsyslog.com/rsyslog-info-1/ [v8.1901.0 try
> https://www.rsyslog.com/e/2207 ]
>
> Running rsyslog version 8.1901.0-1 on clean Debian 10 installation.
> What's wrong here?
>

_______________________________________________
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: set myhostname property value into local variable [ In reply to ]
On Tue, 23 Jul 2019, John Chivian via rsyslog wrote:

> Try with quotes...
>
> set $.host = "$myhostname";

A quirk of the config language, to access properties you need to add a $ to the
front of the property, and in this case the property is $myhostname, so you need
to use $$myhostname

origionally, the properties were only used in templates (like %property%) but
when we started being able to treat them as variables in the new config syntax,
they were accessed by adding a $ in front of the property names. Since some
properties already started with $, this means those now need to start with $$

It would probably be a good thing to put in an enhancement request asking for
all the system properties to be available as $myhostname as well as $$myhostname
(I don't think there are any conflicts)

David Lang
_______________________________________________
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.