This program automates that.
The -2 argument tells it to read the log files twice. You'll want to do this if the thing you are searching for isn't in the first of the log entries relating to the message.
Gzip'ed log files are auto-decompressed.
Status: maintained (until I give up on sendmail)
Last modification: 2003