Easy Tutorial
❮ Redis Java Server Shutdown ❯

Redis Slowlog Command

Redis Server

Redis slowlog is a logging system in Redis used to record the execution time of queries.

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

Additionally, the slow log is stored in memory, making it very fast for read and write operations. You can use it with confidence, without worrying about it impacting Redis performance.

Syntax

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

redis 127.0.0.1:6379> SLOWLOG subcommand [argument]

Available Versions

= 2.2.12

Return Value

The return value depends on the specific command.

Examples

To 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"

To check the current number of logs:

redis 127.0.0.1:6379> SLOWLOG LEN
(integer) 14

The SLOWLOG RESET command can be used to clear the slow log:

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

❮ Redis Java Server Shutdown ❯