English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Showlog Command

Redis Server

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

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

Additionally, the slow log is stored in memory, and the read and write speed is very fast, so you can use it with confidence without worrying about slowing down Redis due to the opening of slow log.

Syntax

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

redis 127.0.0.1:6379> SLOWLOG subcommand [argument]

Available Version

>= 2.2.12

Return Value

Different commands return different values depending on the situation.

Online 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 current number of logs:

redis 127.0.0.1:6379> SLOWLOG LEN
(integer) 14

 

You can use the SLOWLOG RESET command 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