|
Apache module version of cronolog
I have been promising to write a module version of cronolog since I
forget when. Actually I did create one back in the spring of 2001, but I
didn't have time to test it exhaustively so I did't publish it.
The current beta version is available here to download.
Note that this is beta software. I make no guarantees
about its functionality, stability or scalability, however it has been
working on my site for six months now with no ill effects. I would
not recommend using this version in a production environment without
extensive testing.
The module is based on mod_log_config and should be loaded instead of
that module. The configuration directives are exactly as for
mod_log_config except that if the log file name contains any "%"
specifiers then it will be rotated, just as for the standard cronolog.
Note that you must not put a "|/usr/sbin/cronolog" at the start of the
log file template, otherwise you will end up calling the external program.
There is one new configuration directive: CronoLogCacheSize, which
takes an integer from 0 to 50. This is the size of the file cache
used by mod_cronolog and defaults to 10. When a new log file must be
opened and the cache is full of log file descriptors then either the
first descriptor that refers to a log file that is no longer pertinent
or the least recently accessed log file is closed so that the new log
file can be opened. Note that this cacheing happens in each child
process. This cacheing of file descriptors could be made more
sophisticated -- the current scheme is a proof of concept.
To build mod_cronolog you will need to have installed the apxs
tool from the Apache distribution (see the page on dynamic
shared object support on
the Apache web site). Then you should just be able to do:
tar zxvf cronolog-module-beta.tar.gz
cd cronolog-module
make
cp mod_cronolog.so LIBDIR
(where LIBDIR is the directory where your loadable
modules live; on my system this is /usr/lib/apache/, but if
you look in your httpd.conf file you will see a number of
LoadModule directives and you can take the directory from
these.)
You will need to comment out the following line from your
httpd.conf file:
LoadModule config_log_module /usr/lib/apache/mod_log_config.so
and insert or replace it with:
LoadModule cronolog_module /usr/lib/apache/mod_log_cronolog.so
Please let me know if you find any bugs or have any suggestions.
(Of course at some stage I will have to adapt this for Apache 2.x)
Andrew Ford, 18 January 2002
|