access_log and error_log stops


Every so often on one particular virtual server the access_log and error_log file is zero in size and remains that way until I restart apache.

What could be causing that do you think?

Closed (fixed)


Joe's picture
Submitted by Joe on Fri, 06/19/2009 - 02:30 Pro Licensee

Is there any chance anything on the system is deleting and recreating the files without reloading Apache in the process? (Apache has to have root privileges to open those files, and so if they disappear/reappear while Apache is running it would still be writing to an old file-handle no longer attached to those files, or I guess not writing at all. There might be clues in the system-wide error_log.)

Also, make sure Apache isn't writing to /var/log/virtualmin/_access_log .

But Joe's theory about the logs being deleted without an Apache restart also makes sense. I could see this happen if a log rotation doesn't restart Apache.

Hi Joe,

I'm not sure that I have anything that plays with the access logs. Only the software that you guys have in there. It's very sporadic and only on one site. Could awstats have something to do with it?

There seems to be no file or directory /var/log/virtualmin/_access_log

Could you post the block from /etc/logrotate.conf for this virtual server? Perhaps it is not configured correctly..

/home/defence/domains/ /home/defence/domains/ { rotate 5 daily compress postrotate /usr/sbin/apachectl graceful endscript }

That looks fine to me .. when the log is rotated, Apache should be signalled to re-open its log files, and thus start writing to the new one.

One work-around would be to replace the line :

/usr/sbin/apachectl graceful

with whatever command you use to re-start Apache.

I normally use /usr/sbin/apachectl -k graceful

would that make a difference?

The -k flag may help, as the documentation sort-of suggests that it waits till all log files are closed..

If you use this in the logrotate config, does it solve the problem?

Since this problem is intermittent it's hard to perform and immediate test.. I'll just have to wait until / if it occurs again.

I'll report back here if I have any news.

Thanks, Ryan

Ok .. I will close this ticket for now. Please re-open if the problem still happens.

Automatically closed -- issue fixed for 2 weeks with no activity.