'Abnormal log storage path due to Ubuntu logrotate abnormal operation
I am using ubuntu 20.04 and mariadb 10.3.31, and I have finished configuring the slow query log. And the log was created successfully.
But the next day, logrotate started running and there was a problem.
logrotate rotates every day and the log storage period is 7 days. However, even though a new log file was created after midnight, the log was saved in log.1, not the newly created file. So I checked the syslog and saw that there was a logrotate error.
logrotate[634994]: #007mysqladmin: connect to server at 'localhost' failed logrotate[634994]: error: 'Access denied for user 'root'@'localhost' (using password: NO)' logrotate[634956]: error: error running shared postrotate script for '/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log ' systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: logrotate.service: Failed with result 'exit-code'. systemd[1]: Failed to start Rotate log files.
these are the logs.
In addition to this, there is one more problem. Today is the 3rd day after log activation, so I think there should be three log files: log, log.1, and log.2. But there were only two files, log and log.1. Even the log wasn't in either file. My guess is that it was saved to log.2, but I can't find that file.
What the heck is the problem? I'm just new to linux so I guess it's hard to troubleshoot :( I need help...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
