Anyone ever seen this cron daily logrotate error?

Metro2

Well-Known Member
May 24, 2006
530
76
178
USA
cPanel Access Level
Root Administrator
Thanks for taking the time for the detailed reply sneader / Scott. Much appreciated.

Based on your post I've done this:

mv /etc/logrotate.d/httpd /etc/logrotate.d/httpd_BACKUP

And will see how it works out after a couple days.

One thing that I've discovered since I started this thread - recently a bit over a month ago I added a new server to my network and it ran for 3 weeks without any occurrence of this issue. Then I had the CSF/LFD & Mailscanner scripts package installed, and the very next day started getting these alerts. Now, I'm not blaming the CSF packages and indeed it's an excellent product that I wouldn't live without, but my experience would suggest that it might be somehow somehow related.
 

verdon

Well-Known Member
Nov 1, 2003
921
12
168
Northern Ontario, Canada
cPanel Access Level
Root Administrator
Update on my situation: Thanks to Brian D. at cPanel support, I believe we have this sorted out.

My solution was to remove /etc/logrotate.d/httpd, as we believe that all log files in /usr/local/apache/logs/ are already being rotated via the configuration in "WHM -> Apache Configuration -> Log Rotation", with the exception of modsec_audit.log, which is rotated via "/etc/logrotate.d/modsecurity_logs". I am not sure why cPanel doesn't just add a modsec_audit.log checkbox to "WHM -> Apache Configuration -> Log Rotation", but there you go! Problem solved.

- Scott
What's interesting about this... I just went to look over my server, to compare it to your experience. When looking at "WHM -> Apache Configuration -> Log Rotation" there's a message that says in part... "The rotated files will be compressed and stored in /usr/local/apache/logs/archive/" although everything appears to be configured properly, there is in fact no directory /usr/local/apache/logs/archive/ on my server, and it seems to me that the only compressed and backed logs I have are the ones being created by the configuration in /etc/logrotate.d/httpd which are stored in /usr/local/apache/logs/.

You should check yours to be sure you are actually getting rotation, now that you have removed /etc/logrotate.d/httpd. In my case, it seems I would not.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,220
463
"The rotated files will be compressed and stored in /usr/local/apache/logs/archive/" although everything appears to be configured properly, there is in fact no directory /usr/local/apache/logs/archive/
The logs won't rotate if they have not reached the configured threshold size, which is possible if they are manually configured to rotate through LogRotate itself.

Thank you.
 

Rakibur Rahman

Registered
Feb 26, 2015
2
0
1
Jessore, Bangladesh
cPanel Access Level
Root Administrator
I am getting following error daily:

/etc/cron.daily/logrotate:

error: mysqld:21 duplicate log entry for /var/lib/mysql/mysqld.log

/etc/cron.daily/logrotate looks like below
Code:
#!/bin/sh
export TMPDIR=/var/spool/logrotate/tmp

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,220
463
error: mysqld:21 duplicate log entry for /var/lib/mysql/mysqld.log
The /etc/logrotate.d/mysql file should handle the MySQL log rotation configuration automatically. Are you rotating this log file with additional rules in the /etc/cron.daily/logrotate file, or in any other custom logrotate configuration file?

Thank you.