ahh, right the stop function.  I was mainly just trying to capture the
remaining devices that don't match my hostname filters, but if i use the
stop function in each if statement that should do the trick and save
processing too.

Thanks Rainer


On Thu, Jun 27, 2013 at 11:46 PM, Rainer Gerhards
<rgerha...@hq.adiscon.com>wrote:

> On Fri, Jun 28, 2013 at 4:39 AM, David Lang <da...@lang.hm> wrote:
>
> > On Thu, 27 Jun 2013, Orangepeel Beef wrote:
> >
> >  Can you do elsif or else if blocks in rainerscript?
> >>
> >> I haven't seen it in the documentation, but from a comment that Rainer
> > made, I think it can be done as
> >
> >
> yup - it's not stated specifically in the doc, because it is "obvious" (to
> programmers, ok, ok ;)).
>
> You can nest statements as much as you like. "if" is a statement. So
> "obviously" you can nest "if", because it's "just another statement".
> That's how it is defined in most programming languages. The "elsif" is IMHO
> just a bad way to tell an optimizer this is a chain (and from compiler
> theory, I really don't understand why you want this, but this is taking to
> far.
>
> Note that you are free in how you write, so you can easily write
>
> if .. {
> ...
> } else if {
> ....
> } else if {
> ...
> } else {
> ...
> }
>
> Note that in rsyslog if you don't have any statements that are to be
> executed in all cases, it is more performant to use "stop" as soon as you
> are done with the message (the else chain still needs to be evaluated, the
> details depend on how many messages in the batch did not match the previous
> if condition).
>
> HTH
> Rainer
>
> >
> > if re_match($fromhost,'^lb.*') then {
> >   *.* action(type="omprog" binary="/usr/local/sbin/sec_**netscaler"
> >        template="RSYSLOG_**TraditionalFileFormat")
> > } else {
> >
> >   if re_match($fromhost,'^(as|cs|r)**.*') then {
> >     *.* action(type="omprog" binary="/usr/local/sbin/sec_**comware"
> >          template="RSYSLOG_**TraditionalFileFormat")
> >   } else {
> >   *.* action(type="omprob" binary="/usr/local/sbin/sec_**misc"
> >         template="RSYSLOG_**TraditionalFileFormat")
> >   }
> > }
> >
> > so, no direct elsif, but there is an else
> >
> > David Lang
> >
> > ______________________________**_________________
> > rsyslog mailing list
> > http://lists.adiscon.net/**mailman/listinfo/rsyslog<
> http://lists.adiscon.net/mailman/listinfo/rsyslog>
> > http://www.rsyslog.com/**professional-services/<
> 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
> 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.
>
_______________________________________________
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