After upgrading to centOS 6.6 to 6.7 I started getting this alert from Anacron:
/etc/cron.daily/logrotate:
logrotate_script: line 1: /usr/local/bin/mysql: No such file or directory error: error running shared postrotate script for '/var/log/newrelic/php_agent.log ’
here’s logrotate.conf:
# see “man logrotate” for details
rotate log files weekly
weekly
keep 4 weeks worth of backlogs
rotate 4
create new (empty) log files after rotating old ones
create
use date as a suffix of the rotated file
dateext
uncomment this if you want your log files compressed
#compress
RPM packages drop log rotation information into this directory
include /etc/logrotate.d
no packages own wtmp and btmp – we’ll rotate them here
It looks like you’re seeing an issue specific to the newrelic MySQL version there, which doesn’t come with CentOS.
Somewhere in your logrotate config, there is a postrotate script for the “/var/log/newrelic/php_agent.log”.
That postrotate script is pointing to a MySQL location that doesn’t exist.
You’d need to update the config in logrotate being used for that, or the shell script if it’s calling out to a script – and point it to your correct MySQL location. I unfortunately don’t know where that is though, I’m not sure where newrelic stores that.
/etc/logrotate.d/mysqld:/var/log/mysqld.log {
/etc/logrotate.d/mysqld: create 640 mysql mysql
/etc/logrotate.d/mysqld: # just if mysqld is really running
/etc/logrotate.d/mysqld: if test -x /usr/bin/mysqladmin &&
/etc/logrotate.d/mysqld: /usr/bin/mysqladmin ping &>/dev/null
/etc/logrotate.d/mysqld: /usr/bin/mysqladmin flush-logs
/etc/logrotate.d/mysqld-slow:/var/run/mysqld/mysqld-slow.log {
/etc/logrotate.d/mysqld-slow: create 660 mysql mysql
/etc/logrotate.d/mysqld-slow: /usr/bin/mysql -e ‘select @@global.long_query_time into @lqt_save; set global long_query_time=2000; select sleep(2); FLUSH LOGS; select sleep(2); set global long_query_time=@lqt_save;’
/etc/logrotate.d/mysqld-slow:create 660 mysql mysql
/etc/logrotate.d/mysqld-slow:/usr/local/bin/mysql -e ‘select @@global.long_query_time into @lqt_save; set global long_query_time=2000; select sleep(2); FLUSH LOGS; select sleep(2); set global long_query_time=@lqt_save;’
Also, while you’re getting the output of that command above, you may want to edit “/etc/logrotate.d/mysqld-slow”, and make sure any references to “/usr/local/bin/mysql” in there instead point to “/usr/bin/mysql”.
Sorry I’m not sure that link is working properly… Are you referring to the mysql access denied message above?
If so, that’s an issue with the log rotation script trying to access mysql without a password.
It seems like there is a problem with the way that rotation script is created, it may not work properly as-is. I was wondering if removing it, even temporary, resolved the issue.