I'm a little new to this, but our previous developers didn't set up the vhost logs to rotate (or Apache was configured wrong) so while the default logs rotate, the vhost ones do not.
I was reading about how to configure logrotate.d (CentOS 4.x) and I thought I could create a new file "vhosts" with a line like this:
/var/log/httpd/*/*log
However, in the httpd file, it has this: /var/log/httpd/*log
I'm afraid that my line will conflict with the httpd code, because it will also rotate log files in the httpd folder. I would rather not have to add the path for each vhost as we may add a new vhost at any time.
Here's what the folder looks like (all domain sub-folders contain access_log and error_log):
ls -l /var/log/httpd -rw-r--r-- 1 root root 0 Sep 27 2012 access_log -rw-r--r-- 1 root root 4743 Sep 9 2012 access_log-20120909 -rw-r--r-- 1 root root 106443 Sep 16 2012 access_log-20120916 -rw-r--r-- 1 root root 24832 Sep 23 2012 access_log-20120923 -rw-r--r-- 1 root root 11671 Sep 26 2012 access_log-20120927 drwxr-xr-x 2 root root 4096 Jul 2 2012 domain1 drwxr-xr-x 2 root root 4096 Nov 13 2012 domain2 drwxr-xr-x 2 root root 4096 Sep 26 2012 domain3 drwxr-xr-x 2 root root 4096 Sep 6 2012 domain4 -rw-r--r-- 1 root root 431 Aug 11 03:07 error_log -rw-r--r-- 1 root root 1086 Jul 21 03:06 error_log-20130721 -rw-r--r-- 1 root root 2007 Jul 28 03:13 error_log-20130728 -rw-r--r-- 1 root root 893 Aug 4 03:18 error_log-20130804 -rw-r--r-- 1 root root 583 Aug 11 03:07 error_log-20130811 -rw-r--r-- 1 root root 0 Aug 11 03:07 ssl_access_log -rw-r--r-- 1 root root 2043 Jul 21 01:07 ssl_access_log-20130721 -rw-r--r-- 1 root root 1725 Jul 28 03:11 ssl_access_log-20130728 -rw-r--r-- 1 root root 1244 Aug 3 19:29 ssl_access_log-20130804 -rw-r--r-- 1 root root 794 Aug 10 12:17 ssl_access_log-20130811 -rw-r--r-- 1 root root 227 Aug 11 03:07 ssl_error_log -rw-r--r-- 1 root root 1049 Jul 21 01:07 ssl_error_log-20130721 -rw-r--r-- 1 root root 1078 Jul 28 03:11 ssl_error_log-20130728 -rw-r--r-- 1 root root 330 Aug 3 16:02 ssl_error_log-20130804 -rw-r--r-- 1 root root 673 Aug 10 12:17 ssl_error_log-20130811 -rw-r--r-- 1 root root 0 Aug 11 03:07 ssl_request_log -rw-r--r-- 1 root root 2091 Jul 21 01:07 ssl_request_log-20130721 -rw-r--r-- 1 root root 1705 Jul 28 03:11 ssl_request_log-20130728 -rw-r--r-- 1 root root 1193 Aug 3 19:29 ssl_request_log-20130804 -rw-r--r-- 1 root root 827 Aug 10 12:17 ssl_request_log-20130811
ls -lR /var/log/httpd
). It's unclear what is located where on your system. You'll have to find an expression to filter out the vhost logs obviously.<Virtual Host>
configuration you can placeTransferLog
,ErrorLog
andCustomLog
options to specify the location and name of the file. You'll need to create those files with the correct permissions or else apache won't start