mariadb/mariadb-logrotate.patch

33 lines
1.2 KiB
Diff
Raw Normal View History

[2/2] Rebase to 10.11.6 - start using upstream logrotate file Explanation for removed notes follow: | * Enable creation of the log file by logrotate (needed since | /var/log/ isn't writable by mysql user); and set the same 640 | permissions we normally use. This is an ancient artefact. It originates in this commit from 2012 in the 'mysql' package in Fedora: https://src.fedoraproject.org/rpms/mysql/c/d3bdaa4a?branch=rawhide That was at the time, when the DB log resided directly in '/var/log/', rather than '/var/log/some-dir-specific-for-the-DB/'. Since that is no longer the case, the 'create 600 mysql mysql' directive is no longer necessary. | * Comment out the actual rotation commands, so that user must edit | the file to enable rotation. This is unfortunate, but the fact | that the script will probably fail without manual configuration | (to set a root password) means that we can't really have it turned | on by default. Fortunately, in most configurations the log file | is low-volume and so rotation is not critical functionality. This is no longer true. Since MariaDB 10.4, which introduced authentication via the UNIX socket, the 'root' and 'mysql' users can authenticate without login and password. So we can go back to using 'mysqladmin', or 'mariadb-admin' in this case, to flush logs | See discussions at RH bugs 799735, 547007 | * Note they are from Fedora 15 / 16 I found no more useful information there. Only information already mentioned in other notes here. | Update 3/2017 | * it would be big unexpected change for anyone upgrading, if we start shipping it now. | Maybe it is good candidate for shipping with MariaDB 10.2 ? Introduction of MariaDB 10.11 is the perfect time. | * the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost | during flushing, the operation is not atomic. | We should not ship it in that state True, however, no one likely cares about that, in reality, since those logs don't hold any journal-like entries. Explained here: https://github.com/MariaDB/server/pull/1556#issuecomment-941886220 | Update 6/2018 | * the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is | beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can. | * Submited as PR: https://github.com/MariaDB/server/pull/807 It has been dicussed on the upstream thoroughly and was found far from ideal. Now, that we can use 'mysqladmin', or 'mariadb-admin' in this case, safely again, there's no argument to keep using the PID file for flushing logs. | Update 02/2021 | * Enhance the script as proposed in: | https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ Enhanced again now. Significantly this time, however with a vision that the values will become an OS-independent defaults. | * Discussion continues in: | https://jira.mariadb.org/browse/MDEV-16621 Discussion finished. Better start a new one, if needed.
2023-12-18 05:44:39 +00:00
Adjust the 'mariadb.logrotate.sh' script in several ways:
* Use the correct log file pathname for Red Hat installations.
[2/2] Rebase to 10.11.6 - start using upstream logrotate file Explanation for removed notes follow: | * Enable creation of the log file by logrotate (needed since | /var/log/ isn't writable by mysql user); and set the same 640 | permissions we normally use. This is an ancient artefact. It originates in this commit from 2012 in the 'mysql' package in Fedora: https://src.fedoraproject.org/rpms/mysql/c/d3bdaa4a?branch=rawhide That was at the time, when the DB log resided directly in '/var/log/', rather than '/var/log/some-dir-specific-for-the-DB/'. Since that is no longer the case, the 'create 600 mysql mysql' directive is no longer necessary. | * Comment out the actual rotation commands, so that user must edit | the file to enable rotation. This is unfortunate, but the fact | that the script will probably fail without manual configuration | (to set a root password) means that we can't really have it turned | on by default. Fortunately, in most configurations the log file | is low-volume and so rotation is not critical functionality. This is no longer true. Since MariaDB 10.4, which introduced authentication via the UNIX socket, the 'root' and 'mysql' users can authenticate without login and password. So we can go back to using 'mysqladmin', or 'mariadb-admin' in this case, to flush logs | See discussions at RH bugs 799735, 547007 | * Note they are from Fedora 15 / 16 I found no more useful information there. Only information already mentioned in other notes here. | Update 3/2017 | * it would be big unexpected change for anyone upgrading, if we start shipping it now. | Maybe it is good candidate for shipping with MariaDB 10.2 ? Introduction of MariaDB 10.11 is the perfect time. | * the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost | during flushing, the operation is not atomic. | We should not ship it in that state True, however, no one likely cares about that, in reality, since those logs don't hold any journal-like entries. Explained here: https://github.com/MariaDB/server/pull/1556#issuecomment-941886220 | Update 6/2018 | * the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is | beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can. | * Submited as PR: https://github.com/MariaDB/server/pull/807 It has been dicussed on the upstream thoroughly and was found far from ideal. Now, that we can use 'mysqladmin', or 'mariadb-admin' in this case, safely again, there's no argument to keep using the PID file for flushing logs. | Update 02/2021 | * Enhance the script as proposed in: | https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ Enhanced again now. Significantly this time, however with a vision that the values will become an OS-independent defaults. | * Discussion continues in: | https://jira.mariadb.org/browse/MDEV-16621 Discussion finished. Better start a new one, if needed.
2023-12-18 05:44:39 +00:00
* Remove Debian specific code
for the very unlikely, but possible scenario
in which the debian config file would exist.
[2/2] Rebase to 10.11.6 - start using upstream logrotate file Explanation for removed notes follow: | * Enable creation of the log file by logrotate (needed since | /var/log/ isn't writable by mysql user); and set the same 640 | permissions we normally use. This is an ancient artefact. It originates in this commit from 2012 in the 'mysql' package in Fedora: https://src.fedoraproject.org/rpms/mysql/c/d3bdaa4a?branch=rawhide That was at the time, when the DB log resided directly in '/var/log/', rather than '/var/log/some-dir-specific-for-the-DB/'. Since that is no longer the case, the 'create 600 mysql mysql' directive is no longer necessary. | * Comment out the actual rotation commands, so that user must edit | the file to enable rotation. This is unfortunate, but the fact | that the script will probably fail without manual configuration | (to set a root password) means that we can't really have it turned | on by default. Fortunately, in most configurations the log file | is low-volume and so rotation is not critical functionality. This is no longer true. Since MariaDB 10.4, which introduced authentication via the UNIX socket, the 'root' and 'mysql' users can authenticate without login and password. So we can go back to using 'mysqladmin', or 'mariadb-admin' in this case, to flush logs | See discussions at RH bugs 799735, 547007 | * Note they are from Fedora 15 / 16 I found no more useful information there. Only information already mentioned in other notes here. | Update 3/2017 | * it would be big unexpected change for anyone upgrading, if we start shipping it now. | Maybe it is good candidate for shipping with MariaDB 10.2 ? Introduction of MariaDB 10.11 is the perfect time. | * the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost | during flushing, the operation is not atomic. | We should not ship it in that state True, however, no one likely cares about that, in reality, since those logs don't hold any journal-like entries. Explained here: https://github.com/MariaDB/server/pull/1556#issuecomment-941886220 | Update 6/2018 | * the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is | beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can. | * Submited as PR: https://github.com/MariaDB/server/pull/807 It has been dicussed on the upstream thoroughly and was found far from ideal. Now, that we can use 'mysqladmin', or 'mariadb-admin' in this case, safely again, there's no argument to keep using the PID file for flushing logs. | Update 02/2021 | * Enhance the script as proposed in: | https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ Enhanced again now. Significantly this time, however with a vision that the values will become an OS-independent defaults. | * Discussion continues in: | https://jira.mariadb.org/browse/MDEV-16621 Discussion finished. Better start a new one, if needed.
2023-12-18 05:44:39 +00:00
--- mariadb-10.11.6/support-files/mariadb.logrotate.sh 2023-11-08 16:51:43.000000000 +0100
+++ mariadb-10.11.6/support-files/mariadb.logrotate.sh_patched 2023-12-17 18:03:36.955861025 +0100
@@ -6,7 +6,7 @@
# Read https://mariadb.com/kb/en/error-log/ to learn more about logging and
# https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ about rotating logs.
[2/2] Rebase to 10.11.6 - start using upstream logrotate file Explanation for removed notes follow: | * Enable creation of the log file by logrotate (needed since | /var/log/ isn't writable by mysql user); and set the same 640 | permissions we normally use. This is an ancient artefact. It originates in this commit from 2012 in the 'mysql' package in Fedora: https://src.fedoraproject.org/rpms/mysql/c/d3bdaa4a?branch=rawhide That was at the time, when the DB log resided directly in '/var/log/', rather than '/var/log/some-dir-specific-for-the-DB/'. Since that is no longer the case, the 'create 600 mysql mysql' directive is no longer necessary. | * Comment out the actual rotation commands, so that user must edit | the file to enable rotation. This is unfortunate, but the fact | that the script will probably fail without manual configuration | (to set a root password) means that we can't really have it turned | on by default. Fortunately, in most configurations the log file | is low-volume and so rotation is not critical functionality. This is no longer true. Since MariaDB 10.4, which introduced authentication via the UNIX socket, the 'root' and 'mysql' users can authenticate without login and password. So we can go back to using 'mysqladmin', or 'mariadb-admin' in this case, to flush logs | See discussions at RH bugs 799735, 547007 | * Note they are from Fedora 15 / 16 I found no more useful information there. Only information already mentioned in other notes here. | Update 3/2017 | * it would be big unexpected change for anyone upgrading, if we start shipping it now. | Maybe it is good candidate for shipping with MariaDB 10.2 ? Introduction of MariaDB 10.11 is the perfect time. | * the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost | during flushing, the operation is not atomic. | We should not ship it in that state True, however, no one likely cares about that, in reality, since those logs don't hold any journal-like entries. Explained here: https://github.com/MariaDB/server/pull/1556#issuecomment-941886220 | Update 6/2018 | * the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is | beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can. | * Submited as PR: https://github.com/MariaDB/server/pull/807 It has been dicussed on the upstream thoroughly and was found far from ideal. Now, that we can use 'mysqladmin', or 'mariadb-admin' in this case, safely again, there's no argument to keep using the PID file for flushing logs. | Update 02/2021 | * Enhance the script as proposed in: | https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ Enhanced again now. Significantly this time, however with a vision that the values will become an OS-independent defaults. | * Discussion continues in: | https://jira.mariadb.org/browse/MDEV-16621 Discussion finished. Better start a new one, if needed.
2023-12-18 05:44:39 +00:00
-@localstatedir@/mysqld.log @localstatedir@/mariadb.log @logdir@/*.log {
+@LOG_LOCATION@ {
[2/2] Rebase to 10.11.6 - start using upstream logrotate file Explanation for removed notes follow: | * Enable creation of the log file by logrotate (needed since | /var/log/ isn't writable by mysql user); and set the same 640 | permissions we normally use. This is an ancient artefact. It originates in this commit from 2012 in the 'mysql' package in Fedora: https://src.fedoraproject.org/rpms/mysql/c/d3bdaa4a?branch=rawhide That was at the time, when the DB log resided directly in '/var/log/', rather than '/var/log/some-dir-specific-for-the-DB/'. Since that is no longer the case, the 'create 600 mysql mysql' directive is no longer necessary. | * Comment out the actual rotation commands, so that user must edit | the file to enable rotation. This is unfortunate, but the fact | that the script will probably fail without manual configuration | (to set a root password) means that we can't really have it turned | on by default. Fortunately, in most configurations the log file | is low-volume and so rotation is not critical functionality. This is no longer true. Since MariaDB 10.4, which introduced authentication via the UNIX socket, the 'root' and 'mysql' users can authenticate without login and password. So we can go back to using 'mysqladmin', or 'mariadb-admin' in this case, to flush logs | See discussions at RH bugs 799735, 547007 | * Note they are from Fedora 15 / 16 I found no more useful information there. Only information already mentioned in other notes here. | Update 3/2017 | * it would be big unexpected change for anyone upgrading, if we start shipping it now. | Maybe it is good candidate for shipping with MariaDB 10.2 ? Introduction of MariaDB 10.11 is the perfect time. | * the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost | during flushing, the operation is not atomic. | We should not ship it in that state True, however, no one likely cares about that, in reality, since those logs don't hold any journal-like entries. Explained here: https://github.com/MariaDB/server/pull/1556#issuecomment-941886220 | Update 6/2018 | * the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is | beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can. | * Submited as PR: https://github.com/MariaDB/server/pull/807 It has been dicussed on the upstream thoroughly and was found far from ideal. Now, that we can use 'mysqladmin', or 'mariadb-admin' in this case, safely again, there's no argument to keep using the PID file for flushing logs. | Update 02/2021 | * Enhance the script as proposed in: | https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ Enhanced again now. Significantly this time, however with a vision that the values will become an OS-independent defaults. | * Discussion continues in: | https://jira.mariadb.org/browse/MDEV-16621 Discussion finished. Better start a new one, if needed.
2023-12-18 05:44:39 +00:00
# Depends on a mysql@localhost unix_socket authenticated user with RELOAD privilege
@su_user@
@@ -45,11 +45,6 @@
# has thanks to the default use of Unix socket authentication for the 'mysql'
# (or root on Debian) account used everywhere since MariaDB 10.4.
postrotate
- if test -r /etc/mysql/debian.cnf
- then
- EXTRAPARAM='--defaults-file=/etc/mysql/debian.cnf'
- fi
-
if test -x @bindir@/mariadb-admin
then
@bindir@/mariadb-admin $EXTRAPARAM --local flush-error-log \