How to see set/get/ in redis log
Solution 1
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
Solution 2
I used redis-cli monitor > redis.log
and that works just fine for me, better than console.
Related videos on Youtube
Itay Moav -Malimovka
SOreadytohelp Below are some of the open source projects I work on. A PHP Library the wrappes SurveyMonkey's API https://github.com/itay-moav/TheKofClient A tool to Schema Check, manage Stored Procedures, Triggers, Views and get autocompletion: https://github.com/itay-moav/rahl_commander A fun way to point users at the right direction in your site ;-) https://github.com/itay-moav/babahandofgod An old version of WMD which I converted to Mootools, 8 years ago... http://moowmd.awardspace.info Feel free to contact me through linkedin http://www.linkedin.com/in/itaymoav
Updated on May 19, 2020Comments
-
Itay Moav -Malimovka almost 4 years
I need to see what redis gets/sets in the redis log.
I tried to set the redis log level to debug and verbose. This does not show me anything when I set a value. -
cool breeze over 7 yearscould you pipe it to a file somehow?
-
Itay Moav -Malimovka over 6 yearsyes (this was asked 4 years ago) I am piping the output into a file (so I can analyze it later) and that into a colorize script so I get a nice colored logs on my console. We use this in development, not prod.
-
Paul Y almost 4 yearsThanks for this! When piping to a file,
redis-cli monitor > redis_get_set.log
works for me butredis-cli monitor | grep -E ' "(g|s)et" ' > redis_get_set.log
results in a file that remains empty. Any idea why that would be ? (Ubuntu 16.04) -
Itay Moav -Malimovka about 3 years@PaulY what happens when u just do
redis-cli monitor | grep -E ' "(g|s)et" '
-
Laurent Lyaudet almost 2 years@PaulY I had the same problem because grep was case sensitive by default for me. Try
redis-cli monitor | grep -E ' "(G|S)ET" '
. For my use case, I also wanted multi get and truncate oversized entries so I usedredis-cli monitor | grep -E ' "M?(G|S)ET" ' | cut -b 1-240
.