httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jake Scott <Jacob.Sc...@morganstanley.com>
Subject Code submissions: log rotation module
Date Fri, 02 Jul 2010 10:31:52 GMT
Hi apache-dev

We have developed a module for Apache 2.2+ that handles log rotation 
automatically.  We would like to submit the code for review and possible 
inclusion in a future version of the httpd product.

Please find the modle and preliminary documentation attached.

We have been using mod_autorotate in production for around 7 months now 
and it seems stable.  It has been tested on Linux (Redhat ES 3/4/5) and 
FreeBSD 7.x and to a limited extent on Solaris.

We looked at other modules that perform in-server log rotation before 
embarking on this project.  We believe that our solution is superior in 
that the code all runs in the parent process and therefore supports the 
privilege separation model whereby the server is started as root and its 
children as a separate user.  Other modules trigger rotation on file 
writes in the children which can only work when the whole server runs as 
the underuser.

There are a number of enhancements that could be made in future :
  - Support for MS Windows
  - Support for extending the httpd API to allow other modules to hook into
    mod_autorotate's rotation scheme (ie. register their log files with
    mod_autorotate)
  - Support for different rotation schedules per log file


We notice that APR has recently been patched so that it will assist file 
rotation itself and note that this will be available to httpd soon.  It 
might be possible to include support for this in mod_autorotate.. however 
we have some questions:
   - The APR_FOPEN_ROTATING / APR_FOPEN_MANUAL_ROTATE flags seems to cause
     the APR code to close and re-open the file being written when the
     inode of the filename that is open, changes.  In the httpd case, the
     child processes inherit the log FDs from the parent that opens the
     logs at a higher privilege level.  So, I assume that this code will
     not be suitable for httpd as the children will not be able to re-open
     the logs.  Is that the case?..

Please let us know what you think and let me know if there are any 
questions.


Kind regards

Jake Scott

Mime
View raw message