PDA

View Full Version : Lograte and Virtual Hosting


allan
02-13-03, 05:03 PM
Does anyone have a sample configuration for logrotate with virtual hosting? I would like to rotate the logs for some of the sites on my server...but I am having trouble with the syntax.

For what it is worth, each site logs to a seperate file in /var/log/httpd, so example.com would log to:

/var/log/httpd/example.com-access
/var/log/httpd/example.com-error

Thanks in advance

allan
02-13-03, 09:01 PM
Never mind, I figured it out. In the /etc/logrotate.d directory there is an Apache file. You can put in as many files as you want, all separated by spaces:


/var/log/httpd/access_log /var/log/httpd/error_log /var/log/httpd/
domain1.com-access_log /var/log/httpd/domain1.com-error_log
/var/log/httpd/domain2.com-access_log
/var/log/httpd/domain2.com-error_log
/var/log/httpd/domain3.com-access_log
/var/log/httpd/domain3.com-error_log {
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}


make sure there are no line returns between each logfile.