Slow query log empty

Anne

Verified User
Joined
Dec 3, 2015
Messages
72
Hi,

I'm afraid it is a very small thing, but I tried it all and can't find it.
I want to log slow querys (MariaDB 10.2). So what I did was:

in etc/my.cnf.d/server.cnf

I added below:
[mysqld]
local-infile = 0


The lines:
slow_query_log = 1
slow_query_log_file = /var/log/mysql-slow-queries.log
long_query_time = 5


Restarted the service.

Now the slow queries are counted, I can see the number increase in "Slow queries".
But the log file is not created. Also when I create the log file with all permissions to write (666) it stays empty.

If I turn on log-queries-not-using-indexes btw, then I get a lot of logging, so it seems that logging itself works...
But of course I don't want log-queries-not-using-indexes on, way too much data, even when db is optimized.

What am I missing?
 
Last edited:
slow_query_log = 1
I have this in my config as well, but without the = 1 part, not sure if it would matter. Here's my complete slowlog related config:

Code:
[mysqld]
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10.0
log_slow_rate_limit = 1
log_slow_verbosity = query_plan,explain
slow_query_log
log_queries_not_using_indexes = ON
min_examined_row_limit = 50000
log_slow_admin_statements = ON

(Minor disclaimer: This config is for MariaDB 10.3 on a non-directadmin server, but it should be the same.)
 
Hi Kristian,

Thanks it's fixed, but it's strange.

I copied your settings and then it worked. I wanted to know which line was the trick, so I removed them one by one until I was back to the lines I posted above. Restarted the service between every change.

Guess what, now it still works?

slow_query_log = 1
slow_query_log_file = /var/log/mysql-slow-queries.log
long_query_time = 3


I don't get it. The change into your parameters must have tricked something? Well, maybe not very productive to put a lot of time into it. It works now and I can see the slow queries in the log. Also added the log_slow_verbosity = query_plan,explain to it now, it's handy.

Thanks, you helped me out, however, I can't tell exactly how ?
 
Back
Top