On 10/22/2013 11:05 PM, David Lang wrote:
On Tue, 22 Oct 2013, Erik Steffl wrote:
On 10/22/2013 01:10 AM, Rainer Gerhards wrote:
Hi all,
I wonder what are the actual use cases behind the desire to have global
variables in rsyslog. There are two that I know (I describe them very
briefly as they were expressed at length in the past couple of days):
1. counting messages for some reason
2. load-balancing output actions
Number 2 is - I think - a weak one, as this should better go into a
specific facility inside the engine (read: nothing that the admin should
need to emulate in the conf file).
Are there any other *real-world* use cases?
I am asking because I would like to think if future development
directions
of the rsyslog engine should consider the re-addition of global variable
support (which requires a major rewrite).
not sure what are global variables, searched a bit found nothing
(found something in google cache for
http://www.rsyslog.com/doc/rainerscript.html, are those the variables
that start with $/?). We are using variables to set the information we
want to include in CEE messages, e.g.
set $!clusterName = "name";
using $!var since this was before $.var was added. Not sure what the
lifetime of $!var or $.var are, $!var seems to be surviving during
lifetime of rsyslog.
Later on we use $!clusterName in template. This is pretty bad
solution because it can pollute json. It would be really helpful to
have a separate (global) namespace (or ability to parse json into
subtree under $! which you mentioned is a possibility).
From what I understand $.var are local variables and only live during
lifetime of a given message so are n ot suitable for the usage as above.
$! and $. variables only exist for the lifetime of a given message.
$! are the variables that have traditionally been part of the all-json
group. $. variables were added so that you could use variables without
polluting the $! tree
global variables existed in 7.5.4 and 7.5.5 but have now been removed,
they were $/ variables and would continue to exist after a message is
finished.
The problem they had was that the way that statements are executed
results in less than obvious results when you update them for each
message (like a counter)
right now, we are trying to gather examples of what people would want to
do with global variables so that a new mechanism can be implemented.
thanks for the context, I was missing few details,
so is the use case that I presented a valid one for usage of global
variables? The use case I have in mind is having variables set up in one
of the files in /etc/rsyslog.d/ then use them in templates. It seems to
me these should be global variables (even though they are pretty much
constant, i.e. they are only initialized, never changed afdterwards).
This is a somewhat different use case than counters that other people
mentioned (different from the point of vier why we need the global
variables, same from the implementation viewpoint)
erik
_______________________________________________
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.