Merge "Enable MySQL slow query log."

This commit is contained in:
Jenkins 2013-01-14 20:03:46 +00:00 committed by Gerrit Code Review
commit f7e7c6f29f

View File

@ -63,6 +63,21 @@ function configure_database_mysql {
default-storage-engine = InnoDB" $MY_CONF
fi
# Turn on slow query log
sudo sed -i '/log.slow.queries/d' $MY_CONF
sudo sed -i -e "/^\[mysqld\]/ a \
log-slow-queries = /var/log/mysql/mysql-slow.log" $MY_CONF
# Log any query taking longer than a second
sudo sed -i '/long.query.time/d' $MY_CONF
sudo sed -i -e "/^\[mysqld\]/ a \
long-query-time = 1" $MY_CONF
# Log all non-indexed queries
sudo sed -i '/log.queries.not.using.indexes/d' $MY_CONF
sudo sed -i -e "/^\[mysqld\]/ a \
log-queries-not-using-indexes" $MY_CONF
restart_service $MYSQL
}