httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Ford <and...@icarus.demon.co.uk>
Subject Re: suggestion for automatic log file rotation
Date Sun, 24 Nov 1996 11:25:40 GMT
>>>>> "Rob" == Rob Hartill <robh@imdb.com> writes:

    Rob> Andrew Ford wrote:
    >> My question is what do people think of the suggestion?

    Rob> you need to take care of cases where people would want to use
    Rob> date stamped filenames but they don't rotate their logs wach
    Rob> day.

    Rob> e.g. there's a problem if someone uses this feature to name
    Rob> their logfiles but only rotates them once a week/month/etc,
    Rob> or even at an hour other than midnight. If the server is
    Rob> restarted on a different day, it'll insist on opening new
    Rob> logs when the intention was that it continued with the old
    Rob> ones.

    Rob> Renaming the logfiles when you're done with them is simple to
    Rob> do.

I think you are seeing problems where they don't exist.  The
suggestion only addresses the problem of regular, periodic changing of
filenames.   Further functionality could be added by additional
directives if really necessary.

Rotating once a month can be done with "%Y%m" and once a week by
"%Y%U" or "%Y%W" (giving the week number starting a new week on a
Sunday or Monday respectively).  If the server is restarted during the
currency of a particular log file it will continue to write to that
file.

Existing configurations are unaffected, unless someone is using the
"%" character literally in log file names (which I think unlikely),
and even that can be accomodated by changing the "%" to "%%".

>>>>>> "Nathan" == Nathan Neulinger <nneul@umr.edu> writes:

    Nathan> I personally don't see the big deal about processing the
    Nathan> logs with another utility.

    Nathan> I have something set up for all of our servers at our site
    Nathan> that periodically (hourly in some cases) shuffles the
    Nathan> logs... Our setup processes the logs into:

    Nathan> /some/dir/www.server.name:port/access-YYYY-MMM
    Nathan> /some/dir/www.server.name:port/error-YYYY-MMM

    Nathan> Those files are automatically gzipped, the log processor
    Nathan> handles either case.

    Nathan> That central dir is then automatically processed into html
    Nathan> files for the stats. The data files can be removed with
    Nathan> the stats html remaining.

    Nathan> There is no need to kill -HUP or do anything to the
    Nathan> server, all you need to do is null out the file. The next
    Nathan> write by the server will pick up where it left
    Nathan> off. Basically, it just creates a file with a hole in
    Nathan> it. This is not really a problem, as the log processor
    Nathan> will just skip over the nulls. (And with some minor effort
    Nathan> can be made to ignore the holes alltogether.)

    Nathan> It works well for us anyway.

    Nathan> -- Nathan

There isn't a problem with employing scripts to rotate logs.  Allowing
the additional syntax just makes it easier for non-experts to set-up
simply.

If the server uses the same time() value for the timestamp with the
log file entry and to determine whether to start a new file, it will
avoid cases where log file entries find their way into the log file
for the wrong period due to delayed or premature starting of cron
jobs.


A further thought -- if the log file modules are modified to allow
strftime specifiers to be used in file names, then use of syslog for
logging could also be added at the same time.

Andrew
-- 
Andrew Ford                             Email:  andrew@icarus.demon.co.uk
Independent Software Consultant         WWW:    http://www.nhbs.co.uk/aford/
"Brittany", Wells Road,                 Tel:    +44 1452 770836
Eastcombe, Stroud, GL6 7EE, GB          Fax:    +44 1452 770835

Mime
View raw message