On Mon, 21 Oct 2013, Rainer Gerhards wrote:

On Mon, Oct 21, 2013 at 12:09 PM, David Lang <[email protected]> wrote:

On Mon, 21 Oct 2013, Rainer Gerhards wrote:

 On Mon, Oct 21, 2013 at 8:52 AM, Rainer Gerhards
<[email protected]>**wrote:

 On Sun, Oct 20, 2013 at 6:03 PM, Pavel Levshin <[email protected]
wrote:


I am unable to reproduce this behaviour with global variables. This is
what I've tried among others:

    if $/zz % 3 == 0 or $/zz % 3 == 1 then {
        set $/zz = $/zz + 1;
        action(...)
    } else {
        set $/zz = 0;
        action(...)
    }

Could you please explain how is it supposed to work?


It's supposed to work just as you describe it. But indeed, it doesn't do
so, I can reproduce the problem. Looks like a regression. Thanks for
reporting, will now look into it.


OK, looks like I stumbled into my own trap. In script, you access
properties via $<propname>. Global variables have the name $/zz (with zz
being the real name). So to access them, you need to access $$/zz.

I think I got confused about this some time ago, and the doc is also not
correct or at least inconsistent. I now need to work my way through that
mess. Just thought I give you some explanation.


Ouch, this is going to get ugly since $$var actually ends up giving you a
reference to $var not it's value, I believe from prior discussions that the
normal variables are $property of $!var!var,


That previous discussion was wrong, it is $$!var!var - and it does not give
the ref to $var, but it's value.

hmm, I had a problem where I was trying to set var2 = $$!var1 and then delete var1 and the result was that once var1 was deleted, var2 had no value, if var1 wasn't deleted, var2 had a value. when I posted about it, I was told to change $$ to $ (I'll have to go back and dig up the e-mail for the exact syntax that I used), and changing to a single $ on the right side caused everything to work properly after var1 was deleted.

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.

Reply via email to