|
|
80384c |
Adjust the mysql-log-rotate script in several ways:
|
|
|
80384c |
|
|
|
80384c |
* Use the correct log file pathname for Red Hat installations.
|
|
|
80384c |
* Enable creation of the log file by logrotate (needed since
|
|
|
80384c |
/var/log/ isn't writable by mysql user); and set the same 640
|
|
|
80384c |
permissions we normally use.
|
|
|
80384c |
* Comment out the actual rotation commands, so that user must edit
|
|
|
80384c |
the file to enable rotation. This is unfortunate, but the fact
|
|
|
80384c |
that the script will probably fail without manual configuration
|
|
|
80384c |
(to set a root password) means that we can't really have it turned
|
|
|
80384c |
on by default. Fortunately, in most configurations the log file
|
|
|
80384c |
is low-volume and so rotation is not critical functionality.
|
|
|
80384c |
|
|
|
80384c |
See discussions at RH bugs 799735, 547007
|
|
|
80384c |
|
|
|
80384c |
|
|
|
80384c |
diff -up mysql-5.6.19/support-files/mysql-log-rotate.sh.logrotate mysql-5.6.19/support-files/mysql-log-rotate.sh
|
|
|
80384c |
--- mysql-5.6.19/support-files/mysql-log-rotate.sh.logrotate 2014-07-25 11:49:37.237448291 +0200
|
|
|
80384c |
+++ mysql-5.6.19/support-files/mysql-log-rotate.sh 2014-07-25 11:53:17.096840857 +0200
|
|
|
80384c |
@@ -1,14 +1,13 @@
|
|
|
80384c |
-# The log file name and location can be set in
|
|
|
80384c |
-# /etc/my.cnf by setting the "log-error" option
|
|
|
80384c |
-# in either [mysqld] or [mysqld_safe] section as
|
|
|
80384c |
-# follows:
|
|
|
80384c |
+# This logname can be set in /etc/my.cnf
|
|
|
80384c |
+# by setting the variable "log-error"
|
|
|
80384c |
+# in the [mysqld_safe] section as follows:
|
|
|
80384c |
#
|
|
|
80384c |
-# [mysqld]
|
|
|
80384c |
-# log-error=@localstatedir@/mysqld.log
|
|
|
80384c |
+# [mysqld_safe]
|
|
|
80384c |
+# log-error=@LOG_LOCATION@
|
|
|
80384c |
#
|
|
|
80384c |
-# In case the root user has a password, then you
|
|
|
80384c |
-# have to create a /root/.my.cnf configuration file
|
|
|
80384c |
-# with the following content:
|
|
|
80384c |
+# If the root user has a password you have to create a
|
|
|
80384c |
+# /root/.my.cnf configuration file with the following
|
|
|
80384c |
+# content:
|
|
|
80384c |
#
|
|
|
80384c |
# [mysqladmin]
|
|
|
80384c |
# password = <secret>
|
|
|
80384c |
@@ -16,22 +15,24 @@
|
|
|
80384c |
#
|
|
|
80384c |
# where "<secret>" is the password.
|
|
|
80384c |
#
|
|
|
80384c |
-# ATTENTION: The /root/.my.cnf file should be readable
|
|
|
80384c |
-# _ONLY_ by root !
|
|
|
80384c |
+# ATTENTION: This /root/.my.cnf should be readable ONLY
|
|
|
80384c |
+# for root !
|
|
|
80384c |
|
|
|
80384c |
-@localstatedir@/mysqld.log {
|
|
|
80384c |
- # create 600 mysql mysql
|
|
|
80384c |
- notifempty
|
|
|
80384c |
- daily
|
|
|
80384c |
- rotate 5
|
|
|
80384c |
- missingok
|
|
|
80384c |
- compress
|
|
|
80384c |
- postrotate
|
|
|
80384c |
- # just if mysqld is really running
|
|
|
80384c |
- if test -x @bindir@/mysqladmin && \
|
|
|
80384c |
- @bindir@/mysqladmin ping &>/dev/null
|
|
|
80384c |
- then
|
|
|
80384c |
- @bindir@/mysqladmin flush-logs
|
|
|
80384c |
- fi
|
|
|
80384c |
- endscript
|
|
|
80384c |
-}
|
|
|
80384c |
+# Then, un-comment the following lines to enable rotation of mysql's log file:
|
|
|
80384c |
+
|
|
|
80384c |
+#@LOG_LOCATION@ {
|
|
|
80384c |
+# create 640 mysql mysql
|
|
|
80384c |
+# notifempty
|
|
|
80384c |
+# daily
|
|
|
80384c |
+# rotate 3
|
|
|
80384c |
+# missingok
|
|
|
80384c |
+# compress
|
|
|
80384c |
+# postrotate
|
|
|
80384c |
+# # just if mysqld is really running
|
|
|
80384c |
+# if test -x @bindir@/mysqladmin && \
|
|
|
80384c |
+# @bindir@/mysqladmin ping &>/dev/null
|
|
|
80384c |
+# then
|
|
|
80384c |
+# @bindir@/mysqladmin flush-logs
|
|
|
80384c |
+# fi
|
|
|
80384c |
+# endscript
|
|
|
80384c |
+#}
|