Apache log files growing to hundreds of gigabytes

morteza

Member
Dec 8, 2009
20
0
51
Hi everybody,

Some of the accounts hosted on our cPanel servers have error_log files inside their /public_html or its subfolders, sometimes growing to 300GB or more. I'm wondering how this could be stopped so that these files wouldn't grow higher than let's say 2GB.

I can think of cronjobs to flush these files once in a while but these files' paths would change, so it's not the best option. Fixing the errors or adding error pages on the websites also isn't an option, it's something to be done by their webmasters.

Is there any global config or settings in Apache or maybe cPanel to manage this?

Thank you for sharing your knowledge :)
 

SysSachin

Well-Known Member
Aug 23, 2015
604
48
28
India
cPanel Access Level
Root Administrator
Twitter
Hello,
If you can change in php.ini file as below then the error logs will not stored.

In the php.ini file
locate
error_reporting =
And change the value to
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

display_errors = On
And change the value to
display_errors = Off
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello :)

These are the log files for PHP error messages. It's typically a good idea to review the large error_log files to determine why the log file is growing to such a large size. However, beyond that, the best way to address the issue is to setup a cron job as you mentioned.

You may also find this thread helpful:

Massive Error Logs and Suhosin Errors

Thank you.