Mailing List Archive

rsyslog property evaluation
Hello,

As so many before me, I am struggeling with the variables. Or
properties. More precisely, on how to address or evaluate them. A simple
example, that obviously does not work:

---

set $.SERVICE = "default";

if ($fromhost-ip == "192.168.1.12" or $fromhost-ip == "192.168.1.15") then {

        set $.SERVICE = "test";

}

template (name="DynServiceLogFile" type="string"
string="/var/log/$.SERVICE/%HOSTNAME%/system.log")

*.* action(type="omfile" dynaFile="DynServiceLogFile"
template="RSYSLOG_FileFormat")

---

This actually does create a literal "$.SERVICE" directory, but not one
that corresponds to the value of the variable, as of course desired. Not
exactly sure, what I am missing here.

Any hints to documentation that elaborated a little more on that? The
"Variable (Property) types" documentation page only talks about setting
them, but not on how to evaluate. Or my english lacks. Quite possible as
well

Thanks for any help or insight

Ede
_______________________________________________
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: rsyslog property evaluation [ In reply to ]
Sorry for the noise, I should have used my brain first. It is of course:

%$.SERVICE%

Thanks

Ede


Am Wed, 22 Jun 2022 11:35:48 +0200
schrieb Ede Wolf via rsyslog <rsyslog@lists.adiscon.com>:

> Hello,
>
> As so many before me, I am struggeling with the variables. Or
> properties. More precisely, on how to address or evaluate them. A
> simple example, that obviously does not work:
>
> ---
>
> set $.SERVICE = "default";
>
> if ($fromhost-ip == "192.168.1.12" or $fromhost-ip == "192.168.1.15")
> then {
>
>         set $.SERVICE = "test";
>
> }
>
> template (name="DynServiceLogFile" type="string"
> string="/var/log/$.SERVICE/%HOSTNAME%/system.log")
>
> *.* action(type="omfile" dynaFile="DynServiceLogFile"
> template="RSYSLOG_FileFormat")
>
> ---
>
> This actually does create a literal "$.SERVICE" directory, but not
> one that corresponds to the value of the variable, as of course
> desired. Not exactly sure, what I am missing here.
>
> Any hints to documentation that elaborated a little more on that? The
> "Variable (Property) types" documentation page only talks about
> setting them, but not on how to evaluate. Or my english lacks. Quite
> possible as well
>
> Thanks for any help or insight
>
> Ede
> _______________________________________________
> 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.
_______________________________________________
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: rsyslog property evaluation [ In reply to ]
it is a bit confusing, it's an artifact of the history of how features were
added over time, each being a small change to what existed before. If everything
had been thought of initially, there would be more consistancy (but also,
probably the project would never have gotten traction as the whole thing would
have been too massive an undertaking)

David Lang

On Wed, 22 Jun 2022, Ede Wolf via rsyslog wrote:

> Sorry for the noise, I should have used my brain first. It is of course:
>
> %$.SERVICE%
>
> Thanks
>
> Ede
>
>
> Am Wed, 22 Jun 2022 11:35:48 +0200
> schrieb Ede Wolf via rsyslog <rsyslog@lists.adiscon.com>:
>
>> Hello,
>>
>> As so many before me, I am struggeling with the variables. Or
>> properties. More precisely, on how to address or evaluate them. A
>> simple example, that obviously does not work:
>>
>> ---
>>
>> set $.SERVICE = "default";
>>
>> if ($fromhost-ip == "192.168.1.12" or $fromhost-ip == "192.168.1.15")
>> then {
>>
>>         set $.SERVICE = "test";
>>
>> }
>>
>> template (name="DynServiceLogFile" type="string"
>> string="/var/log/$.SERVICE/%HOSTNAME%/system.log")
>>
>> *.* action(type="omfile" dynaFile="DynServiceLogFile"
>> template="RSYSLOG_FileFormat")
>>
>> ---
>>
>> This actually does create a literal "$.SERVICE" directory, but not
>> one that corresponds to the value of the variable, as of course
>> desired. Not exactly sure, what I am missing here.
>>
>> Any hints to documentation that elaborated a little more on that? The
>> "Variable (Property) types" documentation page only talks about
>> setting them, but not on how to evaluate. Or my english lacks. Quite
>> possible as well
>>
>> Thanks for any help or insight
>>
>> Ede
>> _______________________________________________
>> 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.
> _______________________________________________
> 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.
_______________________________________________
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.