Slow Query Log Not Logging
we are trying to have access to our slow query log file at “/var/log/mysql/localhost-slow.log” but it looks like the file is empty. The “my.cnf” file says “!includedir /etc/my.cnf.d”, and inside that directory we have the following files:
mysql-clients.cnf; server.cnf; tokudb.cnf;
Looking at the “server.cnf” file it looks like it’s set properly to write slow queries logs:
# # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] slow-query-log = 1 slow-query-log-file = /var/log/mysql/localhost-slow.log long_query_time = 1 log-queries-not-using-indexes # this is only for embedded server [embedded] # This group is only read by MariaDB-5.5 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mysqld-5.5] # These two groups are only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] [mariadb-5.5]
Any idea on what could be the issue? We’ve tried to add the following:
[mysqld] slow-query-log = 1 slow-query-log-file = /var/log/mysql/localhost-slow.log long_query_time = 1 log-queries-not-using-indexes
directly into my.cnf and then restarting through
service mysql restart but it didn’t work?
Thanks in advance for any help.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.