This blog is now hosted at consciou.us

Wednesday, February 25, 2009

Duplicate message ids in the sendmail log

Here's a quick little perl script that can help you find duplicate message ids in your sendmail log. Script and explanation after the break.


#!perl

while (<>) {
($_ =~ /msgid=\<(.*?)\>?,/) && ($msgid = $1);
$ids{$msgid}++;
print $msgid . "\n" if ($ids{$msgid} == 2);
}


Where to use this script? Let's say, hypothetically, that you have email coming in that is causing the mail server to tempfail a message (over and over). Or you have a server that is sending a mail message over and over. This script can help you find those messages quickly.

No comments: