CLIENT AREACall Us 1-800-383-5193


Call Us 1-800-383-5193


Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Redis Slow Log

by | Mar 13, 2021

Need to know about Redis Slow Log? We can help you.

Recently we had a customer who experienced high latency and high CPU usage with Redis operations. In such a case, Redis Slow Log is one of the best tools to debug and trace the Redis database.

Since Redis base on a single-threaded architecture, Redis Slow Log is much more useful than MySQL Slow Query Log.

As part of our Server Management Services, we assist our customers with several Redis queries.

Today, let us discuss Redis Slow Log.


What is Redis slow log?

It is a system to log queries that exceeded a specified execution time. This does not include I/O operations like talk with the client, reply, and so forth, but the time to actually execute the command.

SLOWLOG subcommand [argument]

This command is available since 2.2.12 and we use it in order to read and reset the Redis slow queries log.


How to setup slow log parameters?

We can configure the slow log with two parameters:

  • slowlog-log-slower-than

This tells Redis what is the execution time, in microseconds, to exceed in order for the command to log.

  • slowlog-max-len

It is the length of the slow log. The minimum value is zero. When a new command logs and the slow log is already at its maximum length, it removes the oldest one from the queue of logged commands in order to make space.

We can edit, redis.conf to do this configuration, or use the CONFIG GET and CONFIG SET commands while the server run.

In addition, it is highly effective at showing the actual processing time of each command.


How to read Slow Log?

The slow log accumulates in memory. This makes it remarkably fast that we can enable the logging of all the commands with a minor performance hit.

Generally, we use the SLOWLOG GET command to read the slow log which returns every entry in the slow log.

It is possible to return only the N most recent entries passing an additional argument to the command (for instance SLOWLOG GET 10).

In addition, our Support Techs suggest having a recent version of redis-cli in order to read the slow log output.

Output format
redis> 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”

There are also optional fields emitted only by Redis 4.0 or greater:

5) “”
6) “worker-123”

Every entry composes of four (or six) fields:

  • A unique progressive identifier for every slow log entry.
  • The unix timestamp at which the logged command process.
  • The amount of time for the execution, in microseconds.
  • The array composing the arguments of the command.
  • Client IP address and port (4.0 only).
  • Client name if set via the CLIENT SETNAME command (4.0 only).

We can use the entry’s unique ID in order to avoid processing slow log entries multiple times.

The ID is never reset in the course of the Redis server execution. However, a server restart can reset it.

In addition, it is possible to get the length of the slow log using the command SLOWLOG LEN.

We can reset the slow log using the SLOWLOG RESET command. Once we delete the information it is lost forever.

[Need help with the Slow Log? We are available 24*7]



In short, Redis Slow Log is one of the best tools to debug and trace the Redis database. Today, we saw how our Support Techs use it to perform the task.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

Your email address will not be published. Required fields are marked *