httpd-users mailing list archives

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

> 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, 'customerdomain.com.log').  However, you may
be able to adapt it.  I actually rotate my Customers'
logs each month, and use the following script:

--- rotate_logs.sh ---
#!/bin/sh
logDir="/var/log/http/websites"

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

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

# Restart Apache
/etc/rc.d/init.d/httpd/start

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

exit 0
--- rotate_logs.sh ---

HTH.

Alan


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

---------------------------------------------------------------------
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