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

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

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

The columns are as follows

  • 1339518083.107412 - Timestamp
  • 0 - Database
  • - 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.

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 Something Digital 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.