You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Elizabeth Mattijsen <li...@xxLINK.nl> on 1997/09/09 03:49:56 UTC

Log file: allow strftime parameters?

At 17:00 8-09-97 -0700, Brian wrote:
>1) the logfiles could close and the new file descriptors for the new logs
>could be passed to the children?

On a related note: maybe it would be an idea to allow "strftime" parameters
in the filepipe specification of CustomLog and TransferLog?  E.g.:

TransferLog	filename.%Y%m%d

would create a log file named "filename.19970908" on September 8th, 1997.
Together with a daily -HUP at midnight, this would create log files with
the date of the log already built in.

Or:

Transferlog	otherfilename.%Y%m%d%H

would create a log file named "otherfilename.1997090817" on September 8th,
1997 at 17:00 hours.  Together with an hourly -HUP on the hour, this would
create log files with the date and hour of the log already "built in".

Rotation other than doing a -HUP at specified intervals, would not be
necessary anymore.  Each -HUP would create a new log file automagically if
necessary.


Now, if -USR would cause the child to write to the new log, that would even
be better.  But I understand that is not easy to do in a portable way.


Elizabeth Mattijsen
xxLINK Internet Services

Re: Log file: allow strftime parameters?

Posted by Rob Hartill <ro...@imdb.com>.
On Tue, 9 Sep 1997, Ben Laurie wrote:

> Elizabeth Mattijsen wrote:
> > 
> > At 08:03 9/9/97 -0600, Marc Slemko wrote:
> > >> > TransferLog        filename.%Y%m%d
> > >>I think most of us agreed (which talking about log file functionality and
> > >>such) that we could go overboard in putting special log file features
> > >>into the server, but we'd never be able to do everything everyone could
> > >>want to do, and it could slow down performance
> > 
> > This change would have minimal impact.  Only at startup, -HUP or -USR time,
> > when the log file is being opened, should the filename be taken through
> > "strftime" instead of being used sec.  Once the file descriptor is there,
> > it is EXACTLY the way it is now.
> > 
> > I agree with the fact that Apache cannot do everything.  On the other hand,
> > this would have minimal CPU and RAM impact whereas it would have relatively
> > large benefits (no piping and no seperate Perl scripts needed for most
> > types of log rotation).
> 
> I must say, I agree this would be useful.

it can also be a problem for people who rotate the logs at times
other than midnight once per day. Sure they can ignore the option but
cron is a more robust solution IMO.
 


Re: Log file: allow strftime parameters?

Posted by Ben Laurie <be...@algroup.co.uk>.
Elizabeth Mattijsen wrote:
> 
> At 08:03 9/9/97 -0600, Marc Slemko wrote:
> >> > TransferLog        filename.%Y%m%d
> >>I think most of us agreed (which talking about log file functionality and
> >>such) that we could go overboard in putting special log file features
> >>into the server, but we'd never be able to do everything everyone could
> >>want to do, and it could slow down performance
> 
> This change would have minimal impact.  Only at startup, -HUP or -USR time,
> when the log file is being opened, should the filename be taken through
> "strftime" instead of being used sec.  Once the file descriptor is there,
> it is EXACTLY the way it is now.
> 
> I agree with the fact that Apache cannot do everything.  On the other hand,
> this would have minimal CPU and RAM impact whereas it would have relatively
> large benefits (no piping and no seperate Perl scripts needed for most
> types of log rotation).

I must say, I agree this would be useful.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 994 6435|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 994 6472|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: Log file: allow strftime parameters?

Posted by Elizabeth Mattijsen <li...@xxLINK.nl>.
At 08:03 9/9/97 -0600, Marc Slemko wrote:
>> > TransferLog	filename.%Y%m%d
>>I think most of us agreed (which talking about log file functionality and 
>>such) that we could go overboard in putting special log file features 
>>into the server, but we'd never be able to do everything everyone could 
>>want to do, and it could slow down performance

This change would have minimal impact.  Only at startup, -HUP or -USR time,
when the log file is being opened, should the filename be taken through
"strftime" instead of being used sec.  Once the file descriptor is there,
it is EXACTLY the way it is now.

I agree with the fact that Apache cannot do everything.  On the other hand,
this would have minimal CPU and RAM impact whereas it would have relatively
large benefits (no piping and no seperate Perl scripts needed for most
types of log rotation).



Elizabeth Mattijsen
xxLINK Internet Services

Re: Log file: allow strftime parameters?

Posted by Elizabeth Mattijsen <li...@xxLINK.nl>.
At 16:29 9/9/97 +0000, Paul Sutton wrote:
>... by contrast, I hated it. I didn't like the way it presumed to know
>when I wanted my logfiles rotated. I much prefer having little shell
>scripts which rotate log files, so I can can do per-rotation processing
>(such as file compression, mailing reports, etc) under my control, via
>crontab. 

My suggestion by itself does NOT rotate anything.  It simply adapts the
name of the logfile to the moment it is created.  You also need a cron job
to have it "rotate" your log (although technically, the log is not rotated
at all, simple a new log with a different name is created when you do the
-HUP).

I have patched my copy of Apache to do this and let the server do a -HUP at
midnight.  It creates exactly bounded logfiles for me that are later
resolved during the night and then get gzipped.  This allows me to do
statistics on any of the vhosts that we have for any period by just
combining the day-logs with gunzip (basically gunzip -c (filelist)
>log.file) and then do statistics on the resulting file.

It gives me complete control.  Without the need to store the logs in a
database format (which I know some of you do).

I just thought it would be a nice addition without any CPU or RAM penalty
to be able to do something which would otherwise require a pipe, which
carries a much heavier penalty CPU and RAM-wise in my opinion.

I can live without it being in the distribution.


Elizabeth Mattijsen
xxLINK Internet Services

Re: Log file: allow strftime parameters?

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Tue, Sep 09, 1997 at 05:29:19PM +0000, Paul Sutton wrote:
> On Tue, 9 Sep 1997, Martin Kraemer wrote:
> > Right, I remember the CERN server had this feature, and I *liked* it!
> > No hassle with scripts which have to do rotation - all done by the server.
> 
> ... by contrast, I hated it. I didn't like the way it presumed to know
> when I wanted my logfiles rotated.

If I remember correctly, it really didn't rotate it automatically. You
still had to send it y SIGHUP if/when you wanted the rotation. The time
stamp was just the starting date. But the server COULD DO IT, if you had
a need for it. But Apache can't. That's why I find the suggestion positive,
because it allows you to do something easily (albeit suboptimal),
or to do it "the optimal" way (even if requiring more programming), whichever
you prefer.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: Log file: allow strftime parameters?

Posted by Paul Sutton <pa...@ukweb.com>.
On Tue, 9 Sep 1997, Martin Kraemer wrote:
> Right, I remember the CERN server had this feature, and I *liked* it!
> No hassle with scripts which have to do rotation - all done by the server.

... by contrast, I hated it. I didn't like the way it presumed to know
when I wanted my logfiles rotated. I much prefer having little shell
scripts which rotate log files, so I can can do per-rotation processing
(such as file compression, mailing reports, etc) under my control, via
crontab. 

//pcs



Re: Log file: allow strftime parameters?

Posted by Marc Slemko <ma...@worldgate.com>.
On Tue, 9 Sep 1997, Martin Kraemer wrote:

> On Tue, Sep 09, 1997 at 04:49:56AM +0200, Elizabeth Mattijsen wrote:
> > TransferLog	filename.%Y%m%d
> > 
> > would create a log file named "filename.19970908" on September 8th, 1997.
> > Together with a daily -HUP at midnight, this would create log files with
> > the date of the log already built in.
> 
> Right, I remember the CERN server had this feature, and I *liked* it!
> No hassle with scripts which have to do rotation - all done by the server.

Brian said in response to this exact thing:

>I think most of us agreed (which talking about log file functionality and 
>such) that we could go overboard in putting special log file features 
>into the server, but we'd never be able to do everything everyone could 
>want to do, and it could slow down performance - a much better 
>alternative is to simply use other programs to manage the log file 
>archiving and such.  For example, the functionality you describe above 
>could be done using a 4-line perl script thrown into a crontab.  It could 
>behoove us to include some example scripts like this in the /utils 
>directory - or maybe a /contrib directory?  Hmm....

back in 95.  


Re: Log file: allow strftime parameters?

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Tue, Sep 09, 1997 at 04:49:56AM +0200, Elizabeth Mattijsen wrote:
> TransferLog	filename.%Y%m%d
> 
> would create a log file named "filename.19970908" on September 8th, 1997.
> Together with a daily -HUP at midnight, this would create log files with
> the date of the log already built in.

Right, I remember the CERN server had this feature, and I *liked* it!
No hassle with scripts which have to do rotation - all done by the server.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: Log file: allow strftime parameters?

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 9 Sep 1997, Christof Damian wrote:

> I think this would be nice. I also think, that log rotation should be
> handled by the server. At the moment I am using "|cronolog ...", but
> that is not useful if you have a lot of log files open.

So don't open a lot of log files ... open one pipe, and add the vhost as
the first field and let your external script do the splitting.  It's
silly to make apache do this work.  There is no convenient place to do
it in Apache given its model.

Dean

> Once I saw a patch for Apache 1.2 to change TransferLog to do log
> rotation, it would be nice if something like this would come as standard
> with apache.
> I think it would be a cleaner solution than (graceful) restarting the
> server every day.
> 
> damian
> -- 
> Christof Damian
> damian@mediaconsult.com / damian@krass.com
> 


Re: Log file: allow strftime parameters?

Posted by Christof Damian <da...@mediaconsult.com>.
Elizabeth Mattijsen wrote:
> 
> At 17:00 8-09-97 -0700, Brian wrote:
> >1) the logfiles could close and the new file descriptors for the new logs
> >could be passed to the children?
> 
> On a related note: maybe it would be an idea to allow "strftime" parameters
> in the filepipe specification of CustomLog and TransferLog?  E.g.:
> 
> TransferLog     filename.%Y%m%d
> 
> would create a log file named "filename.19970908" on September 8th, 1997.
> Together with a daily -HUP at midnight, this would create log files with
> the date of the log already built in.

I think this would be nice. I also think, that log rotation should be
handled by the server. At the moment I am using "|cronolog ...", but
that is not useful if you have a lot of log files open.
Once I saw a patch for Apache 1.2 to change TransferLog to do log
rotation, it would be nice if something like this would come as standard
with apache.
I think it would be a cleaner solution than (graceful) restarting the
server every day.

damian
-- 
Christof Damian
damian@mediaconsult.com / damian@krass.com