[MDEV-22659] Create one single unified and optimal logrotate config Created: 2020-05-21 Updated: 2023-03-31 Resolved: 2022-10-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Packaging, Platform Debian, Platform RedHat, Scripts & Clients, Server |
| Affects Version/s: | 10.5 |
| Fix Version/s: | 10.11.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Otto Kekäläinen | Assignee: | Daniel Black |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Description |
|
Currently we have in 10.5 master two logrotate files:
I suggest we in future would have only one single mariadb.logrotate(.sh) file that would be used in all distros, both deb and rpm based. There is after all only one logrotate utility and the mariadbd responds to system signals the same way across all distros, and the mariadb-admin etc tools also work close enough on all distros. I suggest we use the name 'mariadb' from now on, since the binary is 'mariadbd' from 10.5 onwards. Also I suggest we always use 'logrotate' and not 'log-rotate' in filenames, since the name of the utility is 'logrotate'. There are currently open 2 PRs on fixing this script:
There are also multiple Jira issues:
Also to be considered, that in systemd the logs go to journald and /var/log/mysql stays empty. |
| Comments |
| Comment by Otto Kekäläinen [ 2020-05-21 ] | |||||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-05-28 ] | |||||||||||||||||
|
Hi otto, In my opinion, your PR could probably be improved by incorporating some of the items from this logrotate configuration in the KB: https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/#configuring-logrotate | |||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-05-28 ] | |||||||||||||||||
|
As you can see in the PR, the KB page is linked for more information. In my opinion those extra lines in the KB example are just bloat and do not bring any real value, just adds complexity. | |||||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-05-28 ] | |||||||||||||||||
|
Hi otto, OK, good to know. I added those extra lines to the configuration in the KB page, because I found them valuable. It sounds like you disagree. Personally, I find configuration items like minsize and maxsize extremely valuable. However, I worked in Support for years, and I have had a lot of experiences trying to sift through error logs that were way too big. | |||||||||||||||||
| Comment by Thomas Deutschmann [ 2020-07-01 ] | |||||||||||||||||
|
In Gentoo Linux we are currently shipping
| |||||||||||||||||
| Comment by Daniel Black [ 2020-09-28 ] | |||||||||||||||||
|
Given Debian logrotate got broken https://github.com/MariaDB/server/commit/7803601dcb8e40746a10a4012b0c8eb08274db3e#diff-49ee12f321170f0cc474278bf311255e (this shouldn't have been changed). Lets get this fixed. GeoffMontee what do you regard as a manageable log size? Any advice on duration of logs? whissi Thanks for sharing. I tend to think that monthly like you've done with size limits is better than the daily in #1556. Note whissi Gentoo should be using my_print_defaults --mysqld to server all server options. I've avoided SIGHUP based solutions in favour of minimizing the amount that the server does - | |||||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-09-29 ] | |||||||||||||||||
|
Hi danblack,
My thoughts:
| |||||||||||||||||
| Comment by Thomas Deutschmann [ 2020-09-29 ] | |||||||||||||||||
|
danblack Thank you for the hint regarding "--mysqld" but we cannot use this option in Gentoo: In Gentoo we are packaging MySQL servers without client tools. my_print_defaults is either provided by mariadb-connector-c (which supports --mysqld) or mysql-connector-c package. The latter does not support this option. And for completeness, logrotate script is provided by mysql-init-scripts package. | |||||||||||||||||
| Comment by Daniel Black [ 2020-09-29 ] | |||||||||||||||||
|
whissi thanks, make sense. Additional info from GeoffMontee that didn't contain anything private hey! you're referring to the rotate N option? if both monthly and maxsize are set, then the number of logs rotated may not necessarily be the number of months that pass. for example, if some kind of distributed brute force attack occurs, and log_warnings=2 is set (which is default), then the logs could quickly fill up with "access denied" messages. or if an app doesn't close its connections properly, then it can fill up with "aborted connections" messages as those connections time out. in cases like these, the log could get bigger than maxsize, and it can be rotated earlier than a month. so the N should probably be considered "number of logs", rather than "number of months". i think the optimal number of logs could depend on a lot of factors. for example: if your logs stay fairly clean, then rotate 10 may allow you to maintain 10 full months of logs, while using very little disk space. in short: i don't have an answer that will work for everyone, but i do think somewhere around "10" is probably a number that will work fairly well for most people So thinking maxsize=500MB, rotate=10 for a 5G max size of logs. | |||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-09-29 ] | |||||||||||||||||
|
This issue is already done and there is a PR waiting to be merged. I don't understand why you started re-engineering a new solution now, that seems like duplicate work to me. | |||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-09-29 ] | |||||||||||||||||
What exactly got broken? The commit did not update the logrotate file functionally (just a comment in it). The PR https://github.com/MariaDB/server/pull/1556 switches from mysql-admin to mariadb-admin. | |||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-09-29 ] | |||||||||||||||||
|
Ok, I see it was this change:
The whole line should be removed as I suggested in https://github.com/MariaDB/server/pull/1556 | |||||||||||||||||
| Comment by Daniel Black [ 2020-09-30 ] | |||||||||||||||||
|
I wrote the comments on this issue because #1556 is there. I do plan on using it, just raising the very low values and there was a serg suggested simplification of [ -x mariadb-admin ] in one of the reviews somewhere that I'll find again. | |||||||||||||||||
| Comment by Otto Kekäläinen [ 2021-04-04 ] | |||||||||||||||||
|
Status: PR still pending at https://github.com/MariaDB/server/pull/1556 mschorm/Faramos Promised by email recently to take a look at some point so we get the RPM side validated/completed. | |||||||||||||||||
| Comment by Otto Kekäläinen [ 2021-09-15 ] | |||||||||||||||||
|
Status: PR still pending at https://github.com/MariaDB/server/pull/1556 Also still pending feedback from Michal Schorm. This PR would close half a dozen bugs if merged and it is a pity there is not progress on the RPM side to test/validate this. | |||||||||||||||||
| Comment by Daniel Black [ 2021-12-03 ] | |||||||||||||||||