How to log all or slow Redis queries?

Better Stack Team
Updated on August 25, 2023

Redis does not natively support query logging in the same way that some relational databases like MySQL do. However, you can still gather information about slow Redis commands or monitor Redis activity using a few different methods:

Slow Log

Redis has a built-in slow log that can be configured to log commands that exceed a certain execution time. You can enable this slow log in the Redis configuration file (redis.conf) by adjusting the following settings:

slowlog-log-slower-than 10000  # Log commands that take more than 10 seconds
slowlog-max-len 128            # Keep the last 128 slow log entries

These settings will log commands that take longer than 10 seconds and retain the last 128 entries in the slow log. Adjust the threshold and log length based on your needs.

Monitoring with Redis MONITOR Command

The MONITOR command in Redis allows you to track all commands processed by the server in real-time. Keep in mind that using MONITOR in production can generate a large volume of data and impact performance. To use MONITOR, simply run the following command in the Redis CLI:


This command will display all the commands executed on the Redis server as they happen.

Third-party Tools

If you need more advanced monitoring, logging, and query analysis capabilities for Redis, you may consider using third-party tools specifically designed for Redis monitoring. Some popular tools include:

  • RedisInsight: RedisInsight is a graphical user interface (GUI) for Redis. It provides real-time monitoring and query analysis capabilities.
  • Redis Commander: Redis Commander is another web-based GUI for managing Redis, and it offers some monitoring features.
  • Prometheus and Grafana: You can use the combination of Prometheus for data collection and Grafana for visualization to create custom dashboards for Redis metrics.

To learn more about logging, visit Better Stack Community.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github