0d2dc2
Adjust the mysql-log-rotate script in several ways:
0d2dc2
0d2dc2
* Use the correct log file pathname for Red Hat installations.
0d2dc2
* Enable creation of the log file by logrotate (needed since
0d2dc2
  /var/log/ isn't writable by mysql user); and set the same 640
0d2dc2
  permissions we normally use.
0d2dc2
* Comment out the actual rotation commands, so that user must edit
0d2dc2
  the file to enable rotation.  This is unfortunate, but the fact
0d2dc2
  that the script will probably fail without manual configuration
0d2dc2
  (to set a root password) means that we can't really have it turned
0d2dc2
  on by default.  Fortunately, in most configurations the log file
0d2dc2
  is low-volume and so rotation is not critical functionality.
0d2dc2
0d2dc2
See discussions at RH bugs 799735, 547007
0d2dc2
* Note they are from Fedora 15 / 16
0d2dc2
0d2dc2
Update 3/2017
0d2dc2
* it would be big unexpected change for anyone upgrading, if we start shipping it now.
0d2dc2
  Maybe it is good candidate for shipping with MariaDB 10.2 ?
0d2dc2
* the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost
0d2dc2
  during flushing, the operation is not atomic.
0d2dc2
  We should not ship it in that state
0d2dc2
0d2dc2
Update 6/2018
0d2dc2
* the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is
0d2dc2
  beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can.
0d2dc2
* Submited as PR: https://github.com/MariaDB/server/pull/807
0d2dc2
0d2dc2
Update 02/2021
0d2dc2
* Enhance the script as proposed in:
0d2dc2
  https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/
0d2dc2
* Discussion continues in:
0d2dc2
  https://jira.mariadb.org/browse/MDEV-16621
0d2dc2
f6fbef
--- mariadb-10.5.13-downstream_modified/support-files/mysql-log-rotate.sh	2022-02-22 04:56:35.571185622 +0100
f6fbef
+++ mariadb-10.5.13-downstream_modified/support-files/mysql-log-rotate.sh_patched	2022-02-22 04:56:15.121003580 +0100
f6fbef
@@ -3,36 +3,23 @@
0d2dc2
 # in the [mysqld] section as follows:
0d2dc2
 #
0d2dc2
 # [mysqld]
0d2dc2
-# log-error=@localstatedir@/mysqld.log
0d2dc2
-#
0d2dc2
-# If the root user has a password you have to create a
0d2dc2
-# /root/.my.cnf configuration file with the following
0d2dc2
-# content:
0d2dc2
-#
0d2dc2
-# [mysqladmin]
0d2dc2
-# password = <secret> 
0d2dc2
-# user= root
0d2dc2
-#
0d2dc2
-# where "<secret>" is the password. 
0d2dc2
-#
0d2dc2
-# ATTENTION: This /root/.my.cnf should be readable ONLY
0d2dc2
-# for root !
0d2dc2
+# log-error=@LOG_LOCATION@
0d2dc2
 
0d2dc2
-@localstatedir@/mysqld.log {
0d2dc2
-        # create 600 mysql mysql
0d2dc2
+@LOG_LOCATION@ {
0d2dc2
+        create 600 mysql mysql
f6fbef
         su mysql mysql
0d2dc2
         notifempty
0d2dc2
         daily
0d2dc2
         rotate 3
0d2dc2
         missingok
0d2dc2
         compress
0d2dc2
+        delaycompress
0d2dc2
+        sharedscripts
0d2dc2
     postrotate
0d2dc2
 	# just if mariadbd is really running
0d2dc2
-	if test -x @bindir@/mysqladmin && \
0d2dc2
-	   @bindir@/mysqladmin ping &>/dev/null
0d2dc2
-	then
0d2dc2
-	   @bindir@/mysqladmin --local flush-error-log \
0d2dc2
-              flush-engine-log flush-general-log flush-slow-log
0d2dc2
-	fi
0d2dc2
+        if [ -e @PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid ]
0d2dc2
+        then
0d2dc2
+           kill -1 $(<@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid)
0d2dc2
+        fi
0d2dc2
     endscript
0d2dc2
 }