Slow Query Log Rotation and Expiration¶
Note
This feature is currently considered BETA quality.
Percona has implemented two new variables, max_slowlog_size
and 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.
Warning
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.
Version Specific Information¶
5.5.36-34.0
: Variablemax_slowlog_size
introduced.5.5.36-34.0
: Variablemax_slowlog_files
introduced.
System Variables¶
-
variable
max_slowlog_size
¶ Version Info: - 5.5.36-34.0 – Introduced.
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 slow_query_log_file
.000001.
-
variable
max_slowlog_files
¶ Version Info: - 5.5.36-34.0 – Introduced.
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.
Contact Us
For free technical help, visit the Percona Community Forum.To report bugs or submit feature requests, open a JIRA ticket.
For paid support and managed or professional services, contact Percona Sales.