slow_query_log_file does not match actual filename
Description
Environment
Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0 x86_64)
AFFECTED CS IDs
Smart Checklist
Activity
Oleksandr Kachan August 19, 2024 at 1:27 PM
We found the root cause of the issue. It is going to be fixed for the next Percona Server 8.0 release (8.0.39).
Oleksandr Kachan August 19, 2024 at 12:20 PM
Hello,
I addition, now can confirm issues with slow_query_log_file
system variable value being initialized by the wrong config value. Reproduced it with latest 8.0 code.
show variables like '%log_file';
Variable_name Value
general_log_file mysqld_general
slow_query_log_file mysqld_general.000001
Oleksandr Kachan August 6, 2024 at 12:19 PM
Hello,
The described behavior of slow_query_log_file system variable is a result of how slow log rotation is implemented. When slow log rotation is enabled it adds a numeric extension to log name. This extension is incremented for each new log. The slow_query_log_file now points to currently active slow log file and is updated each time new log file is created. So currently it is expected behavior.
In general this behavior could be changed but we’d need to revise slow log rotation implementation for this.
Aaditya Dubey February 22, 2022 at 3:23 PMEdited
Hi
Thank you for updated reproducible test case, with the given test i'm able to reproduced the issue.
Current behaviour:
Expected behaviour: should have the same name of slow and general log file what is mentioned in configuration file.
Thanks,
Aaditya Dubey
Louis Le Page February 21, 2022 at 3:44 PM
Hi Aaditya,
sorry, my mistake. I forgot to make clear that it happens when enabling the slowlog-rotation by setting `max_slowlog_size = 1G` in the my.cnf.
For some reason I thought the rotation was active per default.
This is also why I linked the Issue where the rotation feature for the slowlog was fixed/enabled. I think they are related.
Without activating the rotation, I get the same results as you and the variables and filenames work as intended.
But with the following configuration I get the described error.
Version for test case:
Minimal settings needed for mysqld in my.cnf (tested with just these vars set):
Restart mysql to load my.cnf:
In runtime this produces:
And creates the following files:
mysql_from_conf.generallog.000001 contais the general-log and mysql_from_conf.slowlog.000001 contains slow-log.
Also, when enabling the slowlog-rotation by setting `max_slowlog_size = 1G` this also changes the name of the file of the general log and adds the same digits as it does with the slowlog, however they are not present in the runtime representation.
The system also seems to rotate the general_log upon restart, as it does with the slow log. However I can not say if that is intended or not.
By setting all variables in my.cnf for mysqld as described above and using the current version `5.7.36-39` you should be able to reproduce the error.
I was able to reproduce it on a new VM with a fresh installation of percona server 5.7.36-39 via apt.
Thank you and best,
Louis
Details
Details
Assignee
Reporter
In progress time
Time tracking
Sprint
Fix versions
Affects versions
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist

Issue
The variable slow_query_log_file at runtime does not match the value defined in the my.cnf file.
However, the file-created matches the slow_query_log_file value from the my.cnf.
The value of slow_query_log_file at runtime seems to use the value of general_log_file, as changing this also changes slow_query_log_file and adds the numbers for rotatingt here.
I think it is related to the Bug-Fixes for PS-1484 which made some changes to the slow_query_log_file, since the problems occurred after an update to 5.7.36-39 and the rotation started working at the same time as the variable happened to behave faulty.
Example
Values in the my.cnf
Values at runtime:
Slowlog Files created: