You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.5 KiB
73 lines
2.5 KiB
Adjust the mysql-log-rotate script in several ways: |
|
|
|
* Use the correct log file pathname for Red Hat installations. |
|
* 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. |
|
* 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. |
|
|
|
See discussions at RH bugs 799735, 547007 |
|
* Note they are from Fedora 15 / 16 |
|
|
|
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 ? |
|
* 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 |
|
|
|
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 |
|
|
|
--- mariadb-10.3.19/support-files/mysql-log-rotate.sh 2019-11-03 17:03:27.000000000 +0100 |
|
+++ mariadb-10.3.19/support-files/mysql-log-rotate.sh_patched 2019-11-06 15:07:54.205379672 +0100 |
|
@@ -3,23 +3,10 @@ |
|
# in the [mysqld] section as follows: |
|
# |
|
# [mysqld] |
|
-# log-error=@localstatedir@/mysqld.log |
|
-# |
|
-# If the root user has a password you have to create a |
|
-# /root/.my.cnf configuration file with the following |
|
-# content: |
|
-# |
|
-# [mysqladmin] |
|
-# password = <secret> |
|
-# user= root |
|
-# |
|
-# where "<secret>" is the password. |
|
-# |
|
-# ATTENTION: This /root/.my.cnf should be readable ONLY |
|
-# for root ! |
|
+# log-error=@LOG_LOCATION@ |
|
|
|
-@localstatedir@/mysqld.log { |
|
- # create 600 mysql mysql |
|
+@LOG_LOCATION@ { |
|
+ create 600 mysql mysql |
|
notifempty |
|
daily |
|
rotate 3 |
|
@@ -27,11 +14,9 @@ |
|
compress |
|
postrotate |
|
# just if mysqld is really running |
|
- if test -x @bindir@/mysqladmin && \ |
|
- @bindir@/mysqladmin ping &>/dev/null |
|
- then |
|
- @bindir@/mysqladmin --local flush-error-log \ |
|
- flush-engine-log flush-general-log flush-slow-log |
|
- fi |
|
+ if [ -e @PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid ] |
|
+ then |
|
+ kill -1 $(<@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid) |
|
+ fi |
|
endscript |
|
}
|
|
|