|
|
f55c7d |
Adjust the mysql-log-rotate script in several ways:
|
|
|
f55c7d |
|
|
|
f55c7d |
* Use the correct log file pathname for Red Hat installations.
|
|
|
f55c7d |
* Enable creation of the log file by logrotate (needed since
|
|
|
f55c7d |
/var/log/ isn't writable by mysql user); and set the same 640
|
|
|
f55c7d |
permissions we normally use.
|
|
|
f55c7d |
* Comment out the actual rotation commands, so that user must edit
|
|
|
f55c7d |
the file to enable rotation. This is unfortunate, but the fact
|
|
|
f55c7d |
that the script will probably fail without manual configuration
|
|
|
f55c7d |
(to set a root password) means that we can't really have it turned
|
|
|
f55c7d |
on by default. Fortunately, in most configurations the log file
|
|
|
f55c7d |
is low-volume and so rotation is not critical functionality.
|
|
|
f55c7d |
|
|
|
f55c7d |
See discussions at RH bugs 799735, 547007
|
|
|
f55c7d |
|
|
|
f55c7d |
|
|
|
f55c7d |
diff -up mariadb-10.2.6/support-files/mysql-log-rotate.sh.p4 mariadb-10.2.6/support-files/mysql-log-rotate.sh
|
|
|
f55c7d |
--- mariadb-10.2.6/support-files/mysql-log-rotate.sh.p4 2017-05-15 01:13:28.000000000 +0200
|
|
|
f55c7d |
+++ mariadb-10.2.6/support-files/mysql-log-rotate.sh 2017-06-18 18:42:19.930844360 +0200
|
|
|
f55c7d |
@@ -1,9 +1,9 @@
|
|
|
f55c7d |
# This logname can be set in /etc/my.cnf
|
|
|
f55c7d |
-# by setting the variable "err-log"
|
|
|
f55c7d |
-# in the [safe_mysqld] section as follows:
|
|
|
f55c7d |
+# by setting the variable "log-error"
|
|
|
f55c7d |
+# in the [mysqld_safe] section as follows:
|
|
|
f55c7d |
#
|
|
|
f55c7d |
-# [safe_mysqld]
|
|
|
f55c7d |
-# err-log=@localstatedir@/mysqld.log
|
|
|
f55c7d |
+# [mysqld_safe]
|
|
|
f55c7d |
+# log-error=@LOG_LOCATION@
|
|
|
f55c7d |
#
|
|
|
f55c7d |
# If the root user has a password you have to create a
|
|
|
f55c7d |
# /root/.my.cnf configuration file with the following
|
|
|
f55c7d |
@@ -18,20 +18,21 @@
|
|
|
f55c7d |
# ATTENTION: This /root/.my.cnf should be readable ONLY
|
|
|
f55c7d |
# for root !
|
|
|
f55c7d |
|
|
|
f55c7d |
-@localstatedir@/mysqld.log {
|
|
|
f55c7d |
- # create 600 mysql mysql
|
|
|
f55c7d |
- notifempty
|
|
|
f55c7d |
- daily
|
|
|
f55c7d |
- rotate 3
|
|
|
f55c7d |
- missingok
|
|
|
f55c7d |
- compress
|
|
|
f55c7d |
- postrotate
|
|
|
f55c7d |
- # just if mysqld is really running
|
|
|
f55c7d |
- if test -x @bindir@/mysqladmin && \
|
|
|
f55c7d |
- @bindir@/mysqladmin ping &>/dev/null
|
|
|
f55c7d |
- then
|
|
|
f55c7d |
- @bindir@/mysqladmin --local flush-error-log \
|
|
|
f55c7d |
- flush-engine-log flush-general-log flush-slow-log
|
|
|
f55c7d |
- fi
|
|
|
f55c7d |
- endscript
|
|
|
f55c7d |
-}
|
|
|
f55c7d |
+# To enable mysql's log file rotation, un-comment the following lines.
|
|
|
f55c7d |
+#@LOG_LOCATION@ {
|
|
|
f55c7d |
+# create 640 mysql mysql
|
|
|
f55c7d |
+# notifempty
|
|
|
f55c7d |
+# daily
|
|
|
f55c7d |
+# rotate 3
|
|
|
f55c7d |
+# missingok
|
|
|
f55c7d |
+# compress
|
|
|
f55c7d |
+# postrotate
|
|
|
f55c7d |
+# # just if mysqld is really running
|
|
|
f55c7d |
+# if test -x @bindir@/mysqladmin && \
|
|
|
f55c7d |
+# @bindir@/mysqladmin ping &>/dev/null
|
|
|
f55c7d |
+# then
|
|
|
f55c7d |
+# @bindir@/mysqladmin --local flush-error-log \
|
|
|
f55c7d |
+# flush-engine-log flush-general-log flush-slow-log
|
|
|
f55c7d |
+# fi
|
|
|
f55c7d |
+# endscript
|
|
|
f55c7d |
+#}
|