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