Slow_query_log_file issue

Hi Team,

we are facing issue with naming the slow query log file. We have following setting in my.cnf
Server Version:
Server version: 8.0.35-27 Percona Server (GPL), Release 27, Revision 2f8eeab2

max_slowlog_files=2

max_slowlog_size=100000000

slow_query_log_file=test_slow.log

slow_query_log=ON

After DB start the name appears to be as below in show global variables.

| slow_query_log_file | /mydata/data/…/.log.000001 |.

Seems its not picking up the correct name.

Also if we give relative path in my.cnf as below

slow_query_log_file=/home/mysqld/test_slow.log

After db restart the global variables shows as below:

| slow_query_log_file | /mydata/data/…/.log.000001 |

Also if we set global variables :
set @@global.slow_query_log_file=‘/home/mysqld/test_slow.log’;

status shows good:
| slow_query_log_file | /home/mysqld/test_slow.log.000001 |

Please help check why its not picking the correct name from my.cnf

Hi @Hussain_Patel.

My first guess would be, there’s another configuration file that’s being read at startup.

You can refer to the documentation, i.e for Linux systems, MySQL will read ALL of the following:
Table 6.2 Option Files Read on Unix and Unix-Like Systems

File Name Purpose
/etc/my.cnf Global options
/etc/mysql/my.cnf Global options
SYSCONFDIR/my.cnf Global options
$MYSQL_HOME/my.cnf Server-specific options (server only)
defaults-extra-file The file specified with --defaults-extra-file, if any
~/.my.cnf User-specific options
~/.mylogin.cnf User-specific login path options (clients only)
DATADIR/mysqld-auto.cnf System variables persisted with SET PERSIST or SET PERSIST_ONLY (server only)

Also, if you have !includedir or !include on any of your configuration files, those will be read as well.

Keep in mind MySQL will read all the values, and it will end up with the last value read; so if the parameter is configured on two different places, the value will be the last “read”.

One other thing to check would be to confirm you’re setting the value on the correct group, i.e not under [client] section.

Best,
Mauricio.

Yes this all is taken care of and not bec of above any.
Seems to be issue with the server.
Can you test in your env once.

Thanks for flagging this.

I’ve tried on a test environment and confirmed the behaviour as you mentioned.
It does seem to be a bug, I’ll try to check a bit further and ask internally before creating a bug ticket.

One thing I’ve noticed (On the latest version, maybe it’s the same on 8.0.35-27), the log is being created with the correct name.

i.e., when you set in your cnf file this:

slow_query_log_file=test_slow.log

You should be able to see the log file with the correct name in your datadir (//test_slow.log
.XXXXXX), even though the incorrect name shows when checking the global variables.

We’ll keep looking into this.
Thanks again for reaching out.
Best,
Mauricio.

Thanks @Mauricio_Cacho

Please share the link to the bug once you report it.

Thanks
Hussain

Hi @Mauricio_Cacho Were you able to check with your team or file a bug?

Thanks
Hussain

Hi @Hussain_Patel , sorry for the delay.

I’ve informed the team, a similar bug was created the same day:
https://perconadev.atlassian.net/browse/PS-9156

Best,
Mauricio.