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