Debugging With Redis MONITOR

Published: October 12, 2017

Today I learned about the Redis MONITOR command. Running it is basically like tail -f-ing Redis…it prints every command issued against the Redis instance, kind of like varnishncsa.

Per the docs…

MONITOR is a debugging command that streams back every command processed by the Redis server

https://redis.io/commands/monitor

When you run it you’ll see something like this…

$ redis-cli monitor
1339518083.107412 [0 127.0.0.1:60866] "keys" "*"
1339518087.877697 [0 127.0.0.1:60866] "dbsize"
1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6"
1339518096.506257 [0 127.0.0.1:60866] "get" "x"
1339518099.363765 [0 127.0.0.1:60866] "del" "x"
1339518100.544926 [0 127.0.0.1:60866] "get" "x"

The columns are as follows

  • 1339518083.107412 - Timestamp
  • 0 - Database
  • 127.0.0.1:60866 - client IP and port
  • ` “get” “x”` - Command

MONITOR was invaluable in helping me debug an issue today. That being said, it’s probably not something you want to have running at all times…

Running a single MONITOR client can reduce the throughput by more than 50%. Running more MONITOR clients will reduce throughput even more.

https://redis.io/commands/monitor

Happy debugging!

Max Chadwick Hi, I'm Max!

I'm a software developer who mainly works in PHP, but loves dabbling in other languages like Go and Ruby. Technical topics that interest me are monitoring, security and performance. I'm also a stickler for good documentation and clear technical writing.

During the day I lead a team of developers and solve challenging technical problems at Rightpoint where I mainly work with the Magento platform. I've also spoken at a number of events.

In my spare time I blog about tech, work on open source and participate in bug bounty programs.

If you'd like to get in contact, you can find me on Twitter and LinkedIn.