Newsyslog for Apache PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Bart Dorlandt   
Sunday, 10 June 2007 16:09

I didn't get logrotating working in Apache so I made it possible by shutting down apache and rotate the logs and putting apache back on. See my script below that is used in crontab.

Script:

#!/bin/sh
apachectl stop >/dev/null 2>&1
newsyslog -F -f /etc/newsyslog.apache.conf
sleep 4
apachectl startssl >/dev/null 2>&1

Crontab, once a month:

0       0       1       *       *       /root/scripts/rotate-apache.sh

newsyslog.apache.conf

# logfile_name          owner:group     mode count size when  flags
/var/www/logs/error_log                                 644  3     *    $M1D0 Z
/var/www/logs/ssl_engine_log                            644  2     *    $M1D0 Z
/var/www/logs/ssl_request_log                           644  2     *    $M1D0 Z
# logs van bart - http
/var/www/logs/bart/access.log                           644  3     *    $W1D0 Z
/var/www/logs/bart/error.log                            644  3     *    $W1D0 Z
/var/www/logs/bart/foto.bamweb.nl.access.log            644  3     *    $M1D0 Z
/var/www/logs/bart/foto.bamweb.nl.error.log             644  3     *    $M1D0 Z
/var/www/logs/bart/hobby.bamweb.nl.access.log           644  3     *    $M1D0 Z
/var/www/logs/bart/hobby.bamweb.nl.error.log            644  3     *    $M1D0 Z

Last Updated on Friday, 13 February 2009 15:31
 


Related items: