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
5da51e
Update 01/2022
5da51e
* added delaycompress option
5da51e
* see https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux
5da51e
5da51e
--- mariadb-10.3.32/support-files/mysql-log-rotate.sh	2022-01-14 17:03:27.000000000 +0100
5da51e
+++ mariadb-10.3.32/support-files/mysql-log-rotate.sh_patched	2022-01-17 15:07:54.205379672 +0100
1042b2
@@ -3,36 +3,22 @@
9dcad6
 # in the [mysqld] section as follows:
a555f2
 #
9dcad6
 # [mysqld]
9dcad6
-# log-error=@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 !
9dcad6
+# log-error=@LOG_LOCATION@
a555f2
 
a555f2
-@localstatedir@/mysqld.log {
a555f2
-        # create 600 mysql mysql
a555f2
+@LOG_LOCATION@ {
a555f2
+        create 600 mysql mysql
1042b2
         su mysql mysql
a555f2
         notifempty
9dcad6
         daily
a555f2
         rotate 3
5da51e
         missingok
a555f2
         compress
5da51e
+        delaycompress
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
 }