It was thus said that the Great Rainer Gerhards once stated:
>
> Note that being an evolution, any currently existing rsyslog.conf would also
> be a valid new conf (via the *same* parser). I have not thought out the full
> semantics and thousand other things that need to be thought of -- this
> actually opened up a can of worms ;) However, I find the proposed format
> seems to be a good compromise between the need to preserve and the need to
> move on, and between the need for simplicity and the need for power.
>
> As such, before I invest even more time into that format, I'd like to get
> some feedback on what you folks think ;)
You need to be very careful when creating your own language. I did that
once (created my own langauge, back in college, just for fun) and recently
benchmarked it against commonly used scripting languages today and the
results were horrible---mine was the slowest tested (Perl, Lua, Python; I
was afraid of testing Ruby in fear to losing there too). That's an issue to
watch out for---a slow interpreter (or particularly bad internal code
representation).
Sure, now you're just adding an "if ... then ... [else ...]" construct
now, but as people get used to this, there might be calls for additional
functionality, like variables (why can't I declare file paths as constants
in one location, etc etc) and pretty soon you'll have a fully blown
programming language (maybe not this year, maybe not next, but some day).
That's a second issue to watch out for---feeping creaturism.
Other than that, I don't really have much to say about the syntax. I know
you're trying to work within an existing framework so you do have some
contraints and I've certainly seen (and worked) with worse configuration
files (sendmail.cf comes to mind).
One last thing though, in looking over your proposed syntax for
RainerScript I see that's it already is awfully close to Lua:
ruleset remote10515 {
if pri("mail.*") then {
action(type="omfile" file="/var/log/remote10514")
action(use="dynfile")
action(type="udpfwd" action.execonlyonce="5sec"
target="192.168.1.2" port="514")
}
action(type="udpfwd" target="192.168.1.3"
action.previousfailed="on")
action(type="omfile" file="/var/log/catchall")
if $severity == 'error' and $msg contains 'Link 2' then
action(type="ommail" server="192.168.1.3"
from="[email protected]"
to="[email protected]"
subject="###error \"detected\"###")
}
could be translated into Lua as:
function remote10515()
if pri("mail.*") then
action { type="omfile" , file="/var/log/remote10514" }
action { use="dynfile" }
action {
type = "udpfwd" ,
action = { execonlyonce="5sec" },
target = "192.168.1.2",
port = 514
}
end
action {
type="udpfwd" ,
target="192.168.1.3" ,
action = { previousfailed = true }
}
action { type="omfile" , file="/var/log/catchall" }
if severity == 'error' and string.find(msg,'Link 2') then
action {
type="ommail",
server="192.168.1.3",
from="[email protected]",
to="[email protected]",
subject=[[###error "detected"###]]
}
end
end
It's a shame you're rejecting Lua---it's considered one of the fastested
scripting languages and dead simple to embed. If you would like to see what
could be done with Lua, you might want to check out my own syslogd I wrote
that embeds Lua:
http://www.conman.org/software/syslogintr/
There is a speed hit (about 35%) in using Lua vs. straight C, but so far,
speed hasn't been an issue in what I do.
-spc (which includes the processing of multiple thin logs into one fat
log)
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com