httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jez Hancock <jez.hanc...@munk.nu>
Subject Re: [users@httpd] Log File Rotation Script
Date Wed, 07 Jan 2004 19:22:34 GMT
On Wed, Jan 07, 2004 at 02:01:36PM -0500, Strader, William Alexander (WAX) wrote:
> SunOS 5.8
> 
> Yeah I read that but was hoping to find a script that moved the logs with
> dates and also archived a month of data...
A nice alternative for logging to a date based template
(/var/logs/httpd/example.com/YYYY/MM/DD/httpd-access.log) is cronolog.
Takes up a lot of procs though for each virtual host you use it for.
Also doesn't perform compression, but that would be easy enough to do
via a cronjob.

cronolog site is here:

http://www.cronolog.org/

> -----Original Message-----
> From: Ben Yau [mailto:byau@cardcommerce.com]
> Sent: Wednesday, January 07, 2004 1:39 PM
> To: users@httpd.apache.org
> Subject: RE: [users@httpd] Log File Rotation Script
> 
> 
> 
> >
> > Does anyone have a example or could send me the program they use to rotate
> > logs?  I am trying to not have to redesign the wheel if possible.  Looking
> > for something that will rotate apache logs daily and then on the first of
> > the month it will tar/gzip last months data into 1 file...
> >
> > Thanks,
> >
> 
> Assuming you are on unix or linux ?
> 
> Read this URL
> http://httpd.apache.org/docs-2.0/logs.html#rotation
> Apache docs on log files and log rotation.  Here is a snippet which tells
> you the commands to use and why to use them.  It can get a little tricker
> when you are doing some sort of webstats analyzation.
> 
> 
> :::
> On even a moderately busy server, the quantity of information stored in the
> log files is very large. The access log file typically grows 1 MB or more
> per 10,000 requests. It will consequently be necessary to periodically
> rotate the log files by moving or deleting the existing logs. This cannot be
> done while the server is running, because Apache will continue writing to
> the old log file as long as it holds the file open. Instead, the server must
> be restarted after the log files are moved or deleted so that it will open
> new log files.
> 
> By using a graceful restart, the server can be instructed to open new log
> files without losing any existing or pending connections from clients.
> However, in order to accomplish this, the server must continue to write to
> the old log files while it finishes serving old requests. It is therefore
> necessary to wait for some time after the restart before doing any
> processing on the log files. A typical scenario that simply rotates the logs
> and compresses the old logs to save space is:
> 
> mv access_log access_log.old
> mv error_log error_log.old
> apachectl graceful
> sleep 600
> gzip access_log.old error_log.old
> 
> Another way to perform log rotation is using piped logs as discussed in the
> next section.
> ::
> 
> 
> Ben Yau
> 
> =================================
> 310.235.2500 x232
> Card Commerce International, Inc.
> http://www.cardcommerce.com
> =================================
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

-- 
Jez Hancock
 - System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - personal weblog
http://ipfwstats.sf.net/        - ipfw peruser traffic logging

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message