Enable MySQL slow query log.
Change-Id: I3db33839bea28abaff01f1d7b7d6698c5dd2c083
diff --git a/lib/databases/mysql b/lib/databases/mysql
index 1c0f5eb..965df6e 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -63,6 +63,21 @@
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
}