On Fri, 2 Dec 2016, Rainer Gerhards wrote:

What exactly do you do with the variables you set inside the if body?
Are they always the same? Where does the data originate from?

I try to understand the scenario better, because I vaguely think I may
be able to find a much simpler solution which would require possible
minimal code changes. But I can't express myself clearer at the
moment, it's more a gut feeling.

It would be good if you could post some *concrete* example of three or
four of the if blocks, that would definitely aid understanding.

he gave a couple of examples a while back.

An example would be populating one variable from several possible sources, depending on the log type. In some cases it may require combining multiple variables so it can't be solved in the parser

along the lines of:

if type = 1 then
  set var = $foo
else if type = 2 then
  set var = $bar
else if type = 3 then
  set var = $baz + $bar

another thing that can be done in this sort of structure is to save different logs in different places (type 1 & 2 go in dir A, type 3 goes in dir B)

or writing the different logs using different templates.

If you look at the rules that I had, you see that I did a lot of that type of thing. But I just did it as if statements

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