If you’ve been running log_recent(), you’ll probably discover that although it’s useful
for getting an idea of what’s happening right now, it’s not very good at telling you
whether any important messages were lost in the noise. By recording information
about how often a particular message appears, you could then look through the messages
ordered by how often they happened to help you determine what’s important.
A simple and useful way of knowing how often a message appears is by storing the
message as a member of a ZSET, with the score being how often the message appears.
To make sure that we only see recent common messages, we’ll rotate our record of
common messages every hour. So that we don’t lose everything, we’ll keep the previous
hour’s worth of common messages. Our code for keeping track of and rotating common
log messages is shown next.
By continuing to use this site, you consent to our updated privacy agreement as described here. You can change your cookie settings at any time as described here but parts of our site will not function correctly without them.