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