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