On Thu, 24 Jun 2010, Rainer Gerhards wrote:

> if $source = 'host1' then
>   do action 1
>   do action 2
>    if $msg contains 'error then
>      do action 3
>    end if
>   do action 4
> else
>  do action 5
> end if

true, XML doesn't have three part tags so it can't do if-the-else but 
there are a few ways to deal with this

<ruleset id='default'>
   <rule filter='$source = "host1"'>
     <action1/>
     <action2/>
     <action3 filter='$msg contains "error"'/>
     <action4>
     <discard>
   </rule>
   <rule>
     <action5/>
   </rule>
</ruleset>

<ruleset id='default'>
   <rule filter='$source = "host1"'>
     <action1/>
     <action2/>
     <action3 filter='$msg contains "error"'/>
     <action4>
   </rule>
   <rule filter='$source != "host1"'>
     <action5/>
   </rule>
</ruleset>

<ruleset id='default'>
   <rule>
   <test filter='$source = "host1"'>
     <match>
       <action1/>
       <action2/>
       <test filter='$msg contains "error"'>
         <match>
           <action3/>
         </match>
       </test>
       <action4>
     </match>
     <nomatch>
       <action5/>
     </nomatch>
   </rule>
</ruleset>

any of these look sane?

unfortunantly I don't know any way of expressing what you are wanting to 
do directly in any config language. you would have to go to an interpreter 
to express things directly because it is directly code logic you are 
expressing. I think that any config language is going to have problems 
with if-then-else

David Lang

> And so on -- I think you grasp what I mean. Expressing this in XML is
> probably impossible (from a readability type of view).
>
> That was one of the reasons I initially thought about creating a full
> RainerScript version. Maybe the original idea was not that bad. Maybe just
> the current design approach sucks ;)
>
> In any case, I think at least I have fallen back to the begin of the cycle,
> where I don't really have an idea where we are heading to...
>
> Rainer
>> -----Original Message-----
>> From: [email protected] [mailto:rsyslog-
>> [email protected]] On Behalf Of Michael Biebl
>> Sent: Thursday, June 24, 2010 4:26 PM
>> To: rsyslog-users
>> Subject: Re: [rsyslog] feedback requested: NEW rsyslog.conf format --
>> XML?
>>
>> Looking at the XML config example I have to admit that I don't really
>> like how it looks and feels.
>>
>> Even david's example looks rather verbose and I also share the concern
>> that such an XML file would be hard to edit using e.g. vi.
>>
>> I just stumbled upon
>> http://stackoverflow.com/questions/1925305/best-config-file-format.
>>
>> One alternative already discussed here, is YAML.
>> Then the site above mentions INI style format, which basically
>> everyone knows but question is, if it's flexible enough.
>> Has anyone experience with JSON or LUA?
>>
>> Cheers,
>> Michael
>>
>>
>> --
>> Why is it that all of the instruments seeking intelligent life in the
>> universe are pointed away from Earth?
>> _______________________________________________
>> rsyslog mailing list
>> http://lists.adiscon.net/mailman/listinfo/rsyslog
>> http://www.rsyslog.com
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com
>
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to