Mysql 5.7.39 Error logs getting empty on ubuntu 18.04

Hello MySQL Percona Community,

We have mysql 5.7.39 on ubuntu 18.04 , i have observed my error log always empty and my error log location is /var/log/mysql. is it auto rotating , where this auto rotation is configured? is my error logs redirected to any other files? want to check errors log and fix this. can someone help on this.

root:/var/log/mysql# ls -lhrt
total 12K
-rw-r----- 1 mysql adm 32 May 8 2022 error.log.8.gz
-rw-r----- 1 mysql adm 0 Dec 20 06:25 error.log
-rw-r----- 1 mysql adm 4.8K Dec 20 06:25 error.log.1

1 Like

Check /etc/logrotate.d This is a common log rotator that is not part of MySQL but usually rotates other application logs.


Looking at the compressed files for the error log looks like logrotate is configured.

Check cronjobs for user ‘mysql’ and ‘adm’ to see if logrotate is configured.

Also, you can check,
cat /var/lib/logrotate/status

One more way to test this is, change mysql error log path in my.cnf

if it works then the original issue caused due to logrotate or some external log rotating script