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