2012-03-24 05:06:31 +00:00
|
|
|
Adjust the mysql-log-rotate script in several ways:
|
2012-01-27 05:58:01 +00:00
|
|
|
|
2012-03-24 05:06:31 +00:00
|
|
|
* Use the correct log file pathname for Red Hat installations.
|
|
|
|
* Enable creation of the log file by logrotate (needed since
|
2012-06-11 21:25:25 +00:00
|
|
|
/var/log/ isn't writable by mysql user); and set the same 640
|
|
|
|
permissions we normally use.
|
2012-03-24 05:06:31 +00:00
|
|
|
* Comment out the actual rotation commands, so that user must edit
|
|
|
|
the file to enable rotation. This is unfortunate, but the fact
|
|
|
|
that the script will probably fail without manual configuration
|
|
|
|
(to set a root password) means that we can't really have it turned
|
|
|
|
on by default. Fortunately, in most configurations the log file
|
|
|
|
is low-volume and so rotation is not critical functionality.
|
2012-01-27 05:58:01 +00:00
|
|
|
|
2012-03-24 05:06:31 +00:00
|
|
|
See discussions at RH bugs 799735, 547007
|
|
|
|
|
|
|
|
|
2013-10-09 15:55:08 +00:00
|
|
|
diff -up mysql-5.6.10/support-files/mysql-log-rotate.sh.orig mysql-5.6.10/support-files/mysql-log-rotate.sh
|
|
|
|
--- mysql-5.6.10/support-files/mysql-log-rotate.sh.orig 2013-01-22 17:54:50.000000000 +0100
|
|
|
|
+++ mysql-5.6.10/support-files/mysql-log-rotate.sh 2013-02-19 15:27:28.448443077 +0100
|
|
|
|
@@ -4,7 +4,7 @@
|
|
|
|
# follows:
|
2012-01-27 05:58:01 +00:00
|
|
|
#
|
2013-10-09 15:55:08 +00:00
|
|
|
# [mysqld]
|
|
|
|
-# log-error=@localstatedir@/mysqld.log
|
|
|
|
+# log-error=/var/log/mysqld.log
|
2012-01-27 05:58:01 +00:00
|
|
|
#
|
2013-10-09 15:55:08 +00:00
|
|
|
# In case the root user has a password, then you
|
|
|
|
# have to create a /root/.my.cnf configuration file
|
|
|
|
@@ -19,19 +19,21 @@
|
|
|
|
# ATTENTION: The /root/.my.cnf file should be readable
|
|
|
|
# _ONLY_ by root !
|
2012-01-27 05:58:01 +00:00
|
|
|
|
|
|
|
-@localstatedir@/mysqld.log {
|
2012-03-24 05:06:31 +00:00
|
|
|
- # create 600 mysql mysql
|
|
|
|
- notifempty
|
2013-10-09 15:55:08 +00:00
|
|
|
- daily
|
|
|
|
- rotate 5
|
2012-03-24 05:06:31 +00:00
|
|
|
- missingok
|
|
|
|
- compress
|
|
|
|
- postrotate
|
|
|
|
- # just if mysqld is really running
|
|
|
|
- if test -x @bindir@/mysqladmin && \
|
|
|
|
- @bindir@/mysqladmin ping &>/dev/null
|
|
|
|
- then
|
|
|
|
- @bindir@/mysqladmin flush-logs
|
|
|
|
- fi
|
|
|
|
- endscript
|
|
|
|
-}
|
|
|
|
+# Then, un-comment the following lines to enable rotation of mysql's log file:
|
|
|
|
+
|
|
|
|
+#/var/log/mysqld.log {
|
2012-06-11 21:25:25 +00:00
|
|
|
+# create 640 mysql mysql
|
2012-03-24 05:06:31 +00:00
|
|
|
+# notifempty
|
2013-10-09 15:55:08 +00:00
|
|
|
+# daily
|
2012-03-24 05:06:31 +00:00
|
|
|
+# rotate 3
|
|
|
|
+# missingok
|
|
|
|
+# compress
|
|
|
|
+# postrotate
|
|
|
|
+# # just if mysqld is really running
|
|
|
|
+# if test -x @bindir@/mysqladmin && \
|
|
|
|
+# @bindir@/mysqladmin ping &>/dev/null
|
|
|
|
+# then
|
|
|
|
+# @bindir@/mysqladmin flush-logs
|
|
|
|
+# fi
|
|
|
|
+# endscript
|
|
|
|
+#}
|