canonical / mysql-k8s-operator

A Charmed Operator for running MySQL on Kubernetes
https://charmhub.io/mysql-k8s
Apache License 2.0
8 stars 15 forks source link

[DPE-3063] Change dateformat in logrotate config to avoid causing filename conflicts after 24hrs of uptime #343

Closed shayancanonical closed 9 months ago

shayancanonical commented 9 months ago

Issue

We are using -%V_%H%M as the dateformat for logrotate - this causes filename conflicts after a day of uptime due to file name conflicts.

Solution

Use -%Y%m%d_%H:%M as the dateformat (for consistency with pgbouncer)

Alternatives

-%u in the dateformat does not get correctly substituted as per the docs:

error: destination /var/log/mysql/archive_general/general.log-%u_1637 already exists, skipping rotation

root@mysql-k8s-0:/# ls -la /var/log/mysql/archive_error/
total 8
drwxrwx--- 2 mysql mysql 4096 Nov 30 16:37 .
drwxr-xr-x 1 mysql mysql 4096 Nov 30 16:37 ..
-rw-r----- 1 mysql mysql    0 Nov 30 16:36 error.log-%u_1637