webserver

How do I resolve the Apache file size limit exceeded error?

If you encounter an error message like the one below, it’s likely because a log file has exceeded the maximum allowed size (in many cases, 2 GB).

[Mon Aug 16 21:40:31 2010] [notice] child pid 17276 exit signal File size limit exceeded (25)

To confirm that that is the case, run the du command below in your Apache logs directory:

du -sh /var/log/httpd/*

If you see any really large log files, the easiest thing to do is to move them and compress them (or you could delete or zero out the file if you didn’t need it for review).
To do so, you can do something like this:

mv /var/log/httpd/error_log /var/log/httpd/error_log.mmddyy
nohup bzip2 -9 /var/log/httpd/error_log.mmddyy &

Once the log has been moved, the bzip2 compression of the new file will run in the background. Once that is complete, you should have a 0 byte log file.

To get Apache functioning normally again, you should be able to restart Apache.

service httpd stop

Confirm that all httpd processes are stopped (ps -ef | grep http).

If no httpd processes are running, you can start Apache.

service httpd start

To alleviate problems like this from reoccurring in the future, you can implement a logrotate script and put it in /etc/logrotate.d/httpd. Below is a sample logrotate script.

/var/log/httpd/*log {
compress
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}

Logrotate generally runs part of /etc/cron.daily, but to confirm, you can review /etc/crontab and look for /etc/cron.daily. If it exists, check the /etc/cron.daily directory for a file named logrotate.

02 4 * * * root run-parts /etc/cron.daily

-rwxr-xr-x 1 root root 180 Mar 11 2009 /etc/cron.daily/logrotate

This should address the file size issues in the future.

3 Comments

3 Comments

  1. contraceptive pills

    September 10, 2010 at 5:43 am

    I cannot thank you enough for the blog article.Thanks Again. Will read on…

  2. tárhely

    October 21, 2010 at 3:23 pm

    I recently came across your site and have been reading along. I imagine I would leave my first comment. I dont know what to say, except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

  3. Arnold Varnado

    November 26, 2010 at 3:57 pm

    Love your site man keep up the good work

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top