Clearing cPanel Error Logs (the one with the cpanel icon Error Log)

durangod

Well-Known Member
May 12, 2012
504
46
78
cPanel Access Level
Website Owner
On the last shared server i was on the error in this section went away after a day or so and i loved seeing the empty page. :)

But now on this VPS i still have items from august in here. I would love to clear them out... is there a way.

this is the one when you click the icon you see this text and a window under it.


This function will display the last 300 errors for your site. This can be very useful for finding broken links or problems with missing files. Checking this log frequently can help keep your site running smoothly.
Last 300 Error Log messages in reverse order:
I have read alot of threads about logs but nothing i found gives me a good answer so far.


How do you clear the old ones? via ssh or via whm and where are they? thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,222
463
Hello :)

Browse to the "Stats and Logs" tab in "WHM Home » Server Configuration » Tweak Settings" and ensure the following option is enabled:

"Delete each domain’s access logs after stats run"

Then, if you don't want to wait for the next stats run, update the statistics for the user manually via:

Code:
/scripts/runweblogs $username
Thank you.
 

durangod

Well-Known Member
May 12, 2012
504
46
78
cPanel Access Level
Website Owner
Hi, is there a step 2 because that was already enabled?

i did change this

Log rotation size threshold (Minimum: 10)
from 300 to 10 but everything else on this page looks good. But i dont think that setting is going to do it because it wont clean it out completly
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,222
463
Are you sure that statistics are updating successfully for this account? Are there any errors when running the command I provided?

Thank you.
 

durangod

Well-Known Member
May 12, 2012
504
46
78
cPanel Access Level
Website Owner
hi, just pm'd you the run, no error that i can see, but i still have all that stuff in there even after that..
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,222
463
I was under the impression you were referring to the "Latest Visitors" option, and thus my instructions were directed towards that. I see now you are referring to the option called "Error Log" within cPanel. This data comes directly from:

Code:
/usr/local/apache/logs/error_log
You would have to manually empty the log file with a command such as:

Code:
echo "" > /usr/local/apache/logs/error_log
Or, configure a lower threshold for "Log rotation size threshold" under "Stats and Logs" in "WHM Home » Server Configuration » Tweak Settings" and then ensure the Error Log is included in "WHM Home » Service Configuration » Apache Configuration » Log Rotation".

Thank you.
 

durangod

Well-Known Member
May 12, 2012
504
46
78
cPanel Access Level
Website Owner
ok well that gets me half way there.. thanks... at least i have a direction, appreciate that very much... I have a email into my old host to see how he had it set up. I doubt very seriously if he did that manually, i know him and he would never take the time to do that all the time for all the accounts. He had to of had some special automated way. Because i remember i would have an error and then fix it, and then it seemed in a few hours or by the next day at least, it was clean, nothing in it. So there must be a way to set that up automated.. :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,222
463
If the log threshold is set to a very low level, then it would likely rotate much sooner. Note that errors are generally helpful and it's often better to address what's causing the error log to fill up in the first place.

Thank you.
 

durangod

Well-Known Member
May 12, 2012
504
46
78
cPanel Access Level
Website Owner
ok we will see how it goes, i will leave it as is for now to see how it rotates, i have quite a bit of config deny set up so it wont take that long to find out.... by the way its clean now and thanks, im so glad i did not have to do that per account...

:) appreciate it