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