Submitted by RyanJohnson on Fri, 06/19/2009 - 02:13
Hi,
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?
Status:
Closed (fixed)
Comments
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.)
Submitted by JamieCameron on Fri, 06/19/2009 - 02:37 Comment #2
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.
Submitted by RyanJohnson on Mon, 06/22/2009 - 02:14 Comment #3
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
Submitted by JamieCameron on Mon, 06/22/2009 - 08:27 Comment #4
Could you post the block from /etc/logrotate.conf for this virtual server? Perhaps it is not configured correctly..
Submitted by RyanJohnson on Mon, 06/22/2009 - 20:39 Comment #5
/home/defence/domains/surfingatlas.com/logs/access_log /home/defence/domains/surfingatlas.com/logs/error_log { rotate 5 daily compress postrotate /usr/sbin/apachectl graceful endscript }
Submitted by JamieCameron on Mon, 06/22/2009 - 21:18 Comment #6
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.
Submitted by RyanJohnson on Tue, 06/23/2009 - 00:07 Comment #7
I normally use /usr/sbin/apachectl -k graceful
would that make a difference?
Submitted by JamieCameron on Tue, 06/23/2009 - 08:31 Comment #8
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?
Submitted by RyanJohnson on Tue, 06/23/2009 - 22:21 Comment #9
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
Submitted by JamieCameron on Tue, 06/23/2009 - 22:43 Comment #10
Ok .. I will close this ticket for now. Please re-open if the problem still happens.
Submitted by Issues on Wed, 07/08/2009 - 02:18 Comment #11
Automatically closed -- issue fixed for 2 weeks with no activity.