You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hugh Williams <hu...@soco.agilent.com> on 2004/01/07 20:22:30 UTC
[users@httpd] Re: Log File Rotation Script
Hi;
I've found cronolog to be quite happy to rotate log files with date
strings in them - it's even mentioned in the Apache documentation. I
crate daily log files and store them in monthly directories.
http://www.cronolog.org/
This will take care of the first part of your request. The compression
bit is a matter of you running a monthly cron job to to the gzip; this
is on the cronolog "wish list" but is not part of the tool at the
moment.
hugh
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...
>
> Thanks,
>
> Billy S.
> WebPool
> Office: (865) 425-5178
> Pager: (865) 417-5012
>
>
> -----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
>
--
Hugh Williams "And the time will come when you'll see
hugh_williams@agilent.com We're all very small
Agilent Technologies And life flows on within you and without you"
Santa Rosa 2LS-R - Beatles
(707)-577-4941
---------------------------------------------------------------------
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