And as Mysql, Redis also slow log to record over the command given time. You can be seen in redis.conf file
The appropriate configuration:
There are two configurations, slowlog-log-slower-than and slowlog-max-len, I am here is to turn over, this is not the default value 0 and 5.
slowlog-log-slower-than set over this time (subtle) command will be added to the slow log.
How many records slowlog-max-len set up to save them slow log
I am here slowlog-log-slower-than settings 0, slowlog-max-len set 5, that all commands are logged to the slow log them,
And record up to five (It is noteworthy that, redis slow log is a FIFO, which means that when more than 5 will be eliminated records added to it first).
Please see below demonstrates:
To view the current slow log
Now has five records, the last one is
So when we add a record will delete the last
Now you can see the set name is the first slow log, but before the last record were deleted.
Bowen above the reference from "Redis Design and Implementation"