Hi, I wasn't too happy with the current mod_log_config design, which turned out to be a bit unflexible in the writer section, so I modified it in order to be able to happily log into a database. The disadvantages of the existing set_writer way of doing things are:
a) The log writer doesn't get all the details of the items to log (namely if they exist or not, i.e. is it 0,"-","NULL" or NULL?), you have to stick with whatever string mod_log_config assembles. b) First everything gets converted into a string only to be converted back to bits and bytes by the database (e.g. MySQL will accept raw data in upcoming releases). Guess this might be a waste of cycles, even if compared to my new design ;) c) You cannot use several log writers at the same time (e.g. log one host into a file and another one into a database). Or at least you'll have to add a bunch of new configuration commands. My approach is simply to move the data -> string conversion from the various log item functions to the log writer itself (and there possibly to decide to dump it completely). Instead of returning strings the log item functions fill out a data block with a pointer to the data (or NULL if the item does not exist) and a type identifier (basically number, string, datetime). The log writer then does whatever it thinks is correct with this data chain. Log writer selection is done within the configuration files by giving Custom-/TransferLog a URL-like descriptor. For example, to log into "log/virtual_only" using the file writer, TransferLog file:log/virtual_only can be used. This is easily extendable, MySQL can e.g. be accessed using CustomLog mysql:[EMAIL PROTECTED]/database "insert ..." Of course, LogFormat is usable, too. So, whatever writer you use, the important stuff can stick to the place where it has always been. Build-in are a file:- (default) and a pipe:-writer. Other writers can be added using a function, this works almost like the old set_writer calls. See mod_log_mysql for an example. The whole thing is 100% backwards compatible (which might make the code look a bit messy :). mod_log_config still accepts data from old-style external log item functions as well as old-style file/pipe paths in Custom-/TransferLog. The set_writer- functions still work, too. That said, I'm a bit unsure if the implementation is correct and bug-free, although it seems to work on my own server - after all, I'm new to this. I'd be happy about any helpful comments on design issues and other thoughts and suggestions. I don't know if it's ok to post the hole 60k here (diff or c doesn't matter), so I put everything up at http://bitbrook.de/privat/st/mod_log_mysql/ , hope nobody minds. Just a click away, after all :) Thanks, soenk.e
