Mariadb slow_query_log keeps disabling

Posted on

Question :

I’m trying to enable slow_query_log on a Mariadb 10.1.32 server.

When slow_query_log is enabled & flushed, logging is successful (slow queries are recorded and written to the file) for a minute or less, before becoming disabled again. By disabled I mean the slow_query_log variable has been set to OFF.

I can’t find any indication in logs (mysql/syslogs) as to what might be disabling the slow_query_log.

Any clues appreciated.

options

| log_output          | FILE                                 |
| slow_query_log_file | /var/log/mysql/mariadb-slow_test.log |

Note slow_query_log_file per my configs is set to /var/log/mysql/mariadb-slow.log; and I had changed to this new ‘test’ file as part of debugging. I see the same behaviour regardless of file.

We’re running the database locally; Debian Jessie.

root@xxxxx:/var/log/mysql# ls -l /var/log/mysql/mariadb-slow_test.log

-rw-rw---- 1 mysql adm 449 May 25 09:40 /var/log/mysql/mariadb-slow_test.log

These configs are set in my.cnf since the last restart:

root@xxxx:/var/log/mysql# cat /etc/mysql/conf.d/mygalera.cnf | grep slow
slow_query_log              = 1
slow_query_log_file         = /var/log/mysql/mariadb-slow.log

Long query time:

MariaDB [(none)]> SELECT @@global.long_query_timeG
*************************** 1. row ***************************
@@global.long_query_time: 10.000000

I pointed the file back to the default (/var/log/mysql/mariadb-slow.log), flush & enable, it logged again until 11:50:

 - -rw-r-----  1 mysql adm   861 May 25 11:47 mariadb-slow.log
 - -rw-r-----  1 mysql adm  2.1K May 25 11:50 mariadb-slow.log

This makes me think there is something scheduled that is disabling it, however event_scheduler is off and nothing in cron.

Answer :

Answering my own question. It turned out to be ClusterControl.

Despite having Performance Schema enabled & configured, ClusterControl’s query monitor was starting & stopping slow_query_log as described here.

Disabling the Query Monitor in cluster control, and enabling slow_query_log resolved the issue.

Leave a Reply

Your email address will not be published. Required fields are marked *