planetp
planetp

Reputation: 16085

How to log all Redis commands executed in a Python script?

I have a Python script that executes Redis commands via redis-py. How can I print the commands being executed when the script runs for debugging purposes? I have access to both the code and the Redis server.

Upvotes: 1

Views: 2267

Answers (1)

Guy Korland
Guy Korland

Reputation: 9568

You can use the Monitor command.

All you have to do is open the redis-cli and call MONITOR, and then it will log every command sent to Redis.

$ redis-cli 
127.0.0.1:6379> MONITOR
OK
1617778908.016538 [0 127.0.0.1:38138] "set" "foo" "bar"

Upvotes: 4

Related Questions