Slow Query Log Rotation and Expiration¶
This feature is currently considered BETA quality.
Percona has implemented two new variables,
max_slowlog_files to provide users with ability to control the slow query log disk usage. These variables have the same behavior as upstream variable max_binlog_size and
max_binlog_files variable used for controlling the binary log.
For this feature to work variable
slow_query_log_file needs to be set up manually and without the
.log sufix. The slow query log files will be named using
slow_query_log_file as a stem, to which a dot and a sequence number will be appended.
Command Line: Yes Config File: Yes Scope: Global Dynamic: Yes Variable Type: numeric Default Value: 0 (unlimited) Range: 4096 - 1073741824
Slow query log will be rotated automatically when its size exceeds this value. The default is
0, don’t limit the size. When this feature is enabled slow query log file will be renamed to
Command Line: Yes Config File: Yes Scope: Global Dynamic: Yes Variable Type: numeric Default Value: 0 (unlimited) Range: 0 - 102400
Maximum number of slow query log files. Used with
max_slowlog_size this can be used to limit the total amount of slow query log files. When this number is reached server will create a new slow query log file with increased sequence number. Log file with the lowest sequence number will be deleted.