httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Murrell <>
Subject Re: [users@httpd] how to rotate log files
Date Wed, 22 Jan 2003 17:02:30 GMT

> first week: all log info are written to access_log
> second week: move access_log to access_log1, 
> third weed: move access_log1 to access+log2. move
> access_log toaccess_log1 
> and so on...

My solution may not be immediately applicable to
yours, as my log-naming convention and location is a
little different (all my customers' logs are stored in
the same directory with a '.log' extenstion; for
example, '').  However, you may
be able to adapt it.  I actually rotate my Customers'
logs each month, and use the following script:

--- ---

# Stop Apache
/etc/rc.d/init.d/httpd stop

# Rotate the logs, and store them in a seperate
for i in $logDir; do
  mv $i.log $logDir/oldlogs/$i-`date-+%F`.log
  rm -f %i.log

# Restart Apache

# Compress old log files
for i in $logDir/oldlogs; do
  /usr/bin/gzip $i.log

exit 0
--- ---



Post your free ad now!

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message