Is cpanel log rotation ever works?

sharmaine001

Well-Known Member
Jun 23, 2006
143
0
166
I have set up error logs to rotate here: Main >> Service Configuration >> Apache Configuration >> Log Rotation

When you open this link, this is what cpanel tells us:

Files chosen here will be rotated from /usr/local/apache/logs by cpanellogd. They are compressed and stored in /usr/local/apache/logs/archive/ with a file for each month that the log is rotated at least once. Hence, the file names *do not relate* in any way to the content of the file being rotated. Also, they are only created when the log file grows larger than 300MB (or the cpanel config value of 'rotatelogs_size_threshhold_in_megabytes' when it is set to something greater than 10). That means that there will often be gaps in the date sequence of the names for files. They are left in place indefinitely. Files not chosen here will not be manipulated by cpanellogd.
I made sure I checked them all, including error logs.

This has been the set up since I installed cpanel more than 4 months ago.

Now I go to /usr/local/apache/logs/ and error_log is not being rotated. Its already 579MB.

Is cpanel log rotation in WHM ever works?
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
I have set up error logs to rotate here: Main >> Service Configuration >> Apache Configuration >> Log Rotation

When you open this link, this is what cpanel tells us:

I made sure I checked them all, including error logs.

This has been the set up since I installed cpanel more than 4 months ago.

Now I go to /usr/local/apache/logs/ and error_log is not being rotated. Its already 579MB.

Is cpanel log rotation in WHM ever works?
What is your full cPanel version number?
 

sharmaine001

Well-Known Member
Jun 23, 2006
143
0
166
Im using 11.25. I didnt check if this was working in the old version 11.24

cPanel 11.25.0-C42048 - WHM 11.25.0 - X 3.9
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
Im using 11.25. I didnt check if this was working in the old version 11.24

cPanel 11.25.0-C42048 - WHM 11.25.0 - X 3.9
Please submit a ticket for this issue; the feature is known to work but I suspect something is interfering that may be causing the difficulty being experienced. When available, please PM me referencing this thread and your new ticket ID number so I may follow-up internally.
 

hillbilly1980

Member
Apr 25, 2005
21
0
151
I was just changing backups today and noticed one of my servers had not be set to rotate it's apache and cpanel logs.

From experience cPanel has never done a good job of log rotation, ( sorry guys, you know it's true). On Freebsd you have to add the following lines to your /etc/newsyslog.conf file.

I was wondering though if there is a pid file for the cpanel webserver generating the logs in /usr/local/cpanel/logs, i'de like newsyslog to give it a signal.




/usr/local/apache/logs/access_log 640 7 * @T00 B /usr/local/apache/logs/httpd.pid 30
/usr/local/apache/logs/error_log 640 7 * @T00 B /usr/local/apache/logs/httpd.pid 30
/usr/local/apache/logs/suexec_log 640 7 * @T00 B /usr/local/apache/logs/httpd.pid 30
/usr/local/cpanel/logs/error_log 640 7 * @T00 B
/usr/local/cpanel/logs/access_log 640 7 * @T00 B
/usr/local/cpanel/logs/stats_log 640 7 * @T00 B
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
I was just changing backups today and noticed one of my servers had not be set to rotate it's apache and cpanel logs.

From experience cPanel has never done a good job of log rotation, ( sorry guys, you know it's true). On Freebsd you have to add the following lines to your /etc/newsyslog.conf file.
"cPanel Log Rotation and Apache Log Rotation as configured in WHM are not enabled by default; they are optional features and would need to be enabled via WHM."
Corrected information: The features cPanel Log Rotation and Apache Log Rotation as configured in WHM may not be enabled by default depending on the version of cPanel installed (e.g., disabled by default in 11.24 as described by cPanelKenneth); they are optional features and, if not activated, would need to be enabled via WHM.

Related Documentation:
WHM: Main >> Service Configuration >> Apache Configuration >> Log Rotation
WHM: Main >> Service Configuration >> cPanel Log Rotation Configuration

I was wondering though if there is a pid file for the cpanel webserver generating the logs in /usr/local/cpanel/logs, i'de like newsyslog to give it a signal.
If it helps with the customization being performed, as a start you may look at the PID of "cpsrvd".
 
Last edited:

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
cPanel Log Rotation and Apache Log Rotation as configured in WHM are not enabled by default; they are optional features and would need to be enabled via WHM.
This was actually a bug introduced in 11.24. We recently fixed this so by default cPanel and Apache service logs will be rotated. This fix is slated for inclusion in 11.25.
 

ikillbill

Well-Known Member
Feb 18, 2008
119
0
66
EA is disabled with log rotation ENABLED

no issue so far these days

however, could we get older EA version back on easyapache?

we do need EA back

thank
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
This was actually a bug introduced in 11.24. We recently fixed this so by default cPanel and Apache service logs will be rotated. This fix is slated for inclusion in 11.25.
To help minimize any confusion I've updated my original post per the above clarification.

EA is disabled with log rotation ENABLED

no issue so far these days

however, could we get older EA version back on easyapache?

we do need EA back

thank
I believe that may be for a different issue, unrelated to cPanel/Apache Log Rotation.
 

sharmaine001

Well-Known Member
Jun 23, 2006
143
0
166
This was actually a bug introduced in 11.24. We recently fixed this so by default cPanel and Apache service logs will be rotated. This fix is slated for inclusion in 11.25.
I am already using 11.25 and log rotation are all checked in WHM but they dont work
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
I am already using 11.25 and log rotation are all checked in WHM but they dont work
Are any of the applicable log files 300 MB or larger in size (disk usage)?

The following two commands will help to verify (by viewing a directory listing):
Code:
# ls -ahl /usr/local/apache/logs /usr/local/apache/logs/archive
# ls -ahl /usr/local/cpanel/logs /usr/local/cpanel/logs/archive
The sub-directory "archive" is created the first time a log file is rotated by cpanellogd (e.g., when a log file reaches 300 MB in size).