Redis slowlog Command

Redis Server

Redis slowlog is a logging system used by Redis to record query execution time.

Query execution time refers to the time spent solely on executing a query command, excluding IO operations such as client response (talking) and sending replies.

Additionally, the slow log is stored in memory and has very fast read/write speed, so you can use it with confidence without worrying that enabling slow log will impair Redis's speed.

Syntax

The basic syntax of the redis slowlog command is as follows:

redis 127.0.0.1:6379> SLOWLOG subcommand [argument]

Available Versions

>= 2.2.12

Return Value

Depending on the command, different values are returned.

Examples

View log information:

redis 127.0.0.1:6379> slowlog get 2
1) 1) (integer) 14
   2) (integer) 1309448221
   3) (integer) 15
   4) 1) "ping"
2) 1) (integer) 13
   2) (integer) 1309448128
   3) (integer) 30
   4) 1) "slowlog"
      2) "get"
      3) "100"

View the number of current logs:

redis 127.0.0.1:6379> SLOWLOG LEN
(integer) 14

You can clear the slow log using the command SLOWLOG RESET.

redis 127.0.0.1:6379> SLOWLOG LEN
(integer) 14

redis 127.0.0.1:6379> SLOWLOG RESET
OK

redis 127.0.0.1:6379> SLOWLOG LEN
(integer) 0

Redis Server

Other Extensions