Latest web development tutorials

Redis Showlog command

Redis server

Redis Redis Showlog is used to record the query execution time logging system.

Query execution time is the response does not include things like client (talking), and other IO operations to send a reply, and just execute a query time-consuming.

In addition, slow log stored in memory inside, read and write very fast, so you can safely use it, do not worry because open slow log detriment Redis speed.

grammar

redis Showlog basic command syntax is as follows:

redis 127.0.0.1:6379> SLOWLOG subcommand [argument]

Available versions

> = 2.2.12

return value

Depending on the command, it returns a different value.

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"

Check the number of the current log:

redis 127.0.0.1:6379> SLOWLOG LEN
(integer) 14

Using the command SLOWLOG RESET can be emptied 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