debuggingloggingconfigurationredis

How to see SET/GET commands in Redis


I need to see what Redis GET/SET commands are executed on Redis.
I tried to set the Redis log level to debug and verbose. This does not show me anything when I set a value.


Solution

  • Unless it's important that you get in the log, in which case I don't think I can help you, you should be able to use the MONITOR command:

    MONITOR is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database. This command can both be used via redis-cli and via telnet.

    You could do something like:

    redis-cli monitor | grep -E ' "(g|s)et" '
    

    Note that there is a performance cost, though (it's mentioned in the linked docs as roughly 50%).

    Pipe it to a file:

    redis-cli monitor | grep -E ' "(g|s)et" ' > redis_get_set.log