Apache stops logging hits

Ever since I installed Virtualmin, I have ran into a weird issue with Apache not logging hits to any of my virtual servers at completely random times. Just now I noticed that access_log hits appear to have stopped being recorded on Jan 31st and have not started back up.

I saw one other post about this issue here, but I have not been able to resolve it. This is a stock virtualmin install without anything special about it. The only way to get hits to be recorded again is to restart Apache.

Any tips or things I could look at?




Wanted to update that this is the issue I had found about this a few weeks ago:


I tried adding the -k as suggested but it does not seem to have corrected it unfortunately


/var/log/virtualmin/hidden.com_access_log /var/log/virtualmin/hidden.com_error_log {
rotate 5
/usr/sbin/apachectl -k graceful

More info about the system:

[root@server1 etc]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda 15G 8.1G 6.9G 55% /
tmpfs 181M 0 181M 0% /dev/shm

[root@server1 etc]# cat /etc/redhat-release
CentOS release 5.4 (Final)

[root@server1 etc]# free -m
total used free shared buffers cached
Mem: 360 295 64 0 2 93
-/+ buffers/cache: 199 160
Swap: 255 172 83

This is a Xen VPS

If you restart Apache, does logging resume again?

It sounds like the old log file may have been rotated without Apache re-opening the log?


Yes, it works fine after restarting Apache. There's no external software that rotates or touches the logs outside of whatever comes preinstalled with Virtualmin, IE logrotate, awstats, and webalizer.

One way to test if logrotate is actually doing the right thing is to force a rotation with a command like :

logrotate -f /etc/logrotate.conf

then view one of your websites, and check if new entries appear in the domain's ~/logs/access_log file.

Yep... forcing that to run made Apache start recording hits again.

What would I look at for a reason why that is? There were no errors being shown when I ran it several times and the logs do appear to be rotated correctly on their own:

-rw-rw---- 1 domain apache 0 Feb 4 11:57 domain.com_access_log
-rw-rw---- 1 domain apache 20 Feb 4 11:57 domain.com_access_log.1.gz
-rw-rw---- 1 domain apache 20 Feb 4 11:55 domain.com_access_log.2.gz
-rw-rw---- 1 domain apache 20 Feb 4 11:53 domain.com_access_log.3.gz
-rw-rw---- 1 domain apache 35392 Jan 31 04:02 domain.com_access_log.4.gz
-rw-rw---- 1 domain apache 42518 Jan 24 04:02 domain.com_access_log.5.gz

-rw-rw---- 1 domain apache 121 Feb 4 11:57 domain.com_error_log
-rw-rw---- 1 domain apache 144 Feb 4 11:57 domain.com_error_log.1.gz
-rw-rw---- 1 domain apache 134 Feb 4 11:55 domain.com_error_log.2.gz
-rw-rw---- 1 domain apache 20 Feb 4 11:53 domain.com_error_log.3.gz
-rw-rw---- 1 domain apache 1042 Jan 31 04:02 domain.com_error_log.4.gz
-rw-rw---- 1 domain apache 1070 Jan 24 04:02 domain.com_error_log.5.gz

It is hard to debug this, as it looks like logrotate may have failed in some way..

Did this happen for all your domains, or just one?

Actually it was all of them except for 1. I added a new virtual server January 29th (restored it from another Virtualmin server), and it appears that this one virtual server continued to have hits logged to it while the rest stopped recording hits January 31st.

Very strange timing. It doesn't coincide with anything.

The other times this happened, nothing had changed such as this, it just randomly stops recording hits. When that happens it is all of them.

The only work-around I can come up with to make sure the logs are rotated is to edit the logrotate.conf file, and change

/usr/sbin/apachectl -k graceful


/etc/init.d/httpd restart