Wednesday, July 06, 2011

Why omusrmsg is evil - and how it is fixed...

Traditional syslog files simply use the user name (or "*" for all) to send messages to users. For example, this selector will forward all mail error messages to the poor mail admin named "madmin":

mail.err madmin

This syntax is (somewhat) intuitive, but causes severe issues when it comes to extending the configuration language. Let's assume the mail admin is named Ian Faber and has the user name "if". So the syslog selector would be

mail.err if


This is ok with traditional config files, but creates a problem if the language is extended. For example, rsyslog has an "if expression then" construct. Question now: how to differentiate between the user name "if" and the "if" construct? Rsyslog uses context information in order to do this. At the start of a line "if" must be the "if" construct, because "if" as a user name would require a filter in front of it. This works pretty well, but creates some complexity during config file parsing. It may also be counter-intuitive to many users. If the language is further extended (as I am doing in v6), it creates considerable extra complexity.

To resolve that ambiguity, I have upgraded omusrmsg, which handles this kind of actions, to support the regular rsyslog syntax for action configuration. You now write:

mail.err :omusrmsg:if


The extra ":omusrmsg:" tells rsyslog explicitely that an action starts and so clearly flags what the "if" stand for. This is a very vital update, and so I am extending it into all versions starting with v4. I am right now working on these changes and will release all versions ASAP. I'll create another post when this is done. It is highly recommended to use the new syntax exclusively. The older syntax will go away in a while.

No comments: