On Wed, 2010-06-30 at 17:00 -0400, Sean Conner wrote: > 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).
Don't mistake "general programming language" via "config language for a specialised engine". Full ACK for "general programming language". > 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 Don't think in terms of "constraints", but in terms of "options" and "levels of (programming) freedom". "Constraints" sounds like a bad thing from legacy. In fact, what I need is the ability to do some very special, high performance things ;) > It's a shame you're rejecting Lua---it's considered one of the fastested > scripting languages and dead simple to embed. OK, Lua again. I've now written up why I don't consider Lua (or any other general-purpose language) a vital alternative for use in rsyslog: http://blog.gerhards.net/2010/07/why-i-think-lua-is-no-solution-for.html Please look carefully at the arguments, especially the facts that a) I do like things like Lua, but not in this context b) Lua misses support for SIMD processing c) Lua does not permit to execute based in the inherent partial order of config statements > 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. Well, that's a primary difference: speed is on of the *prime* concerns in rsyslog. I have looked at your implementation. Of course, I could have saved myself roughly 3 to 4 years of work if I used the same approach -- and rsyslog would most probably not be the alternative to syslog-ng it currently is. Also, I question if the typical sysadmin will actually like the format that you promote. All of the examples really scared me away. I have quoted the replacement for a standard red hat syslog.conf after my signature so that the other list members can do their own judgment. Rainer Now the replacement for a standard Red Hat syslog.conf with syslogintr (taken from above-mentioned URL, file "readhat.lua" inside the offered tarball): -- *************************************************************** -- -- Copyright 2010 by Sean Conner. All Rights Reserved. -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Comments, questions and criticisms can be sent to: [email protected] -- -- ****************************************************************** -- -- A file the duplicates a default install of RedHat and their syslog.conf -- file. All functions not labeled as "local" are called directly via the -- runtime engine. -- -- cleanup() - called when the daemon exits -- reload_signal() - called when the program recieves a SIGHUP -- log() - called each time the daemon receives a message -- -- This is provided as a means to replace syslogd with a drop in -- replacement, but with the ability to expand upon the functionality as -- required. -- -- ******************************************************************* function cleanup() messages:close() secure:close() maillog:close() cron:close() spooler:close() boot:close() end -- ********************************************************************* local function openfiles() messages = io.open("/var/log/messages","a") or io.stdout secure = io.open("/var/log/secure" ,"a") or io.stdout maillog = io.open("/var/log/maillog" ,"a") or io.stdout cron = io.open("/var/log/cron" ,"a") or io.stdout spooler = io.open("/var/log/spooler" ,"a") or io.stdout boot = io.open("/var/log/boot" ,"a") or io.stdout end openfiles() -- ********************************************************************* function reload_signal() cleanup() openfiles() end -- ********************************************************************* local function logfile(msg,file,flushp) local flushp = flushp or false if msg.remote == false then msg.host = "localhost" end file:write(string.format( "%s %s %s[%d]: %s\n", os.date("%b %d %H:%M:%S",msg.timestamp), msg.host, msg.program, msg.pid, msg.msg )) if flushp then file:flush() end end -- ****************************************************************** local function everybody(msg) local out = io.popen("/usr/bin/wall","w") logfile(msg,out) out:close() end -- ****************************************************************** function log(msg) if msg.level == 'info' or msg.level == 'notice' or msg.level == 'warn' or msg.level == 'err' or msg.level == 'crit' or msg.level == 'alert' or msg.level == 'emerg' then if msg.facility ~= 'mail' and msg.facility ~= 'auth2' and msg.facility ~= 'cron' and msg.facility ~= 'local6' then logfile(msg,messages) end end if msg.facility == 'auth2' then logfile(msg,secure) end if msg.facility == 'mail' then logfile(msg,maillog,true) end if msg.facility == 'cron' then logfile(msg,cron) end if msg.level == 'emerg' then everybody(msg) end if msg.facility == 'uucp' or msg.facility == 'news' then if msg.level == 'crit' or msg.level == 'alert' or msg.level == 'emerg' then logfile(msg,spooler) end end if msg.facility == 'local7' then logfile(msg,boot) end end -- ******************************************************************** _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com

