-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL log rotation can break under certain circumstances #523
Comments
Thank you for reporting us your feedback! The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-5535.
|
Thanks for the report @barryprice , we will check this asap |
@barryprice doing a quick check, logrotate configuration seems to be working as expected. The retention period is 7 days, which will account for max Can you check if that big file was within this retention period? It can be the case to disable general log, and/or tweak the retention period. |
The logrotate config only seems to refer to files that don't exist - there is no, e.g. Just to be clear, we expect 7 days total retention, and rotation once per hour? The file in question began with data from three days prior via |
Hi @barryprice , thanks for the quick reply. The juju debug log should have entries for failed calls to the flush log routines, can you retrieve the logs, with debug log level?
Once per minute |
Apologies for the delay here. I've provided the entire unit log (i.e. |
We've worked through this internally, for anyone following in the same situation who needs a quick fix: Where
Note the returned password, SSH to the unit and:
Enter the password returned by the earlier
You should find that this creates the missing files and cleans up the older ones. I think the charm could/should be better able to prevent this from happening in the first place, but that's the workaround AIUI. Edit: I've updated the initial description and title to closer match our understanding after going over this, thanks! |
Adding to this, on this unit I'm looking at, there are 14GiB of general logs with the oldest being:
The There's also this:
So the |
We upgraded to the 8.0/stable r313 release a few days back, but I guess this fix either wasn't included or doesn't actually fix the problem here, as we were alerted for a 33G |
And another one today for a 33GB |
Dear @kot0dama , @barryprice , the logrotation fix We are discussing the possible hotfixes here... |
The config option general_log is not compatible with the real productions due to dumping all SQL queries to the general.log: https://dev.mysql.com/doc/refman/8.0/en/query-log.html > ... The server writes information to this log when clients connect or > disconnect, and it logs each SQL statement received from clients... In the past, it was a necessary evil as we had to keep record all connects/disconnects from the clients for security reasons. Nowadays we have audit_log plugin enabled by default, therefor no need to pay such a high performance price and struggle from the general.log size #523 (comment) > 33GB /var/snap/charmed-mysql/common/var/log/mysql/archive_general/general.log-20241212_0013 Additionally, we are working on the logs compression spec (separate topic). --- While working here, we have noticed unnecessary enabled plugin audit_log_filter which also produces log files in /var/lib/mysql. Disabling it for now, as it is not necessary for audit_log plugin announcer functionality. We will consider re-enabling the plugin without rush in https://warthogs.atlassian.net/browse/DPE-6235
The followup tickets / PR: The plan is to give 8.0/candidate with the fixed logs ASAP. |
Thanks, it'd be great if we could get a hotfix release ahead of the EOY break so that folks aren't woken up by this when on-call. |
Steps to reproduce
Expected behavior
logrotate should rotate mysql's log files to avoid filling the disk
Actual behavior
Under certain circumstances, the charm appears to get into a confused state and MySQL starts writing to log files that should already have bee rotated, the bundled logrotate logic stops working and doesn't rotate the actual open log files - which eventually will fill the disk.
logrotate config:
Actual contents of the log directory when the charm's in this state:
We found this file under the archive_general dir recently:
Versions
Operating system: Ubuntu 22.04.4 LTS
Juju CLI: 2.9.51-ubuntu-amd64
Juju agent: 2.9.49
Charm revision: 8.0/stable / 240
LXD: none
Log output
Juju debug log: not relevant
Additional context
The installed mysql snap is:
The text was updated successfully, but these errors were encountered: