#!/usr/bin/perl -w

# Sample Rows from mimedefang's md_log()

#Sep 28 21:55:50 westover mimedefang.pl[16803]: MDLOG,g8T2th86016917,mail_out,,,<mimedefang@westover.org>,<defang-admin@westover.org>,SPAM: 21.9, Make Money 100% RISK FREE!
#Sep 28 21:55:52 westover mimedefang.pl[16803]: MDLOG,g8T2th88016917,mail_out,,,<mimedefang@westover.org>,<defang-admin@westover.org>,SPAM: 20.3, Access Your PC from Anywhere - Download Now
#Sep 28 21:55:55 westover mimedefang.pl[16803]: MDLOG,g8T2th8A016917,mail_out,,,<mimedefang@westover.org>,<defang-admin@westover.org>,SPAM: 32.8, /ADV / The Best Business Opportunity on Net
#Sep 28 21:55:57 westover mimedefang.pl[16803]: MDLOG,g8T2th8C016917,mail_out,,,<mimedefang@westover.org>,<defang-admin@westover.org>,SPAM: 16.6, Get the lowest long distance rates available.
#Sep 28 21:56:02 westover mimedefang.pl[16803]: MDLOG,g8T2tt82016932,spam,38,203.167.97.19,<joisie69@hotmail.com>,<vernonm@westover.org>,I did not belive it....
#Sep 28 21:56:09 westover mimedefang.pl[16803]: MDLOG,g8T2u782016945,mail_out,,,<mimedefang@westover.org>,<defang-admin@westover.org>,SPAM: 38, I did not belive it....

$event{'mimedefang.pl'}{'general'} = 
sub {
	if ($text =~ m/^[A-Za-z0-9]{14}:\s*MDLOG,\S+?,(\S+?),(\S*?),(\S*?),(.*?),(.*?),(.*)$/ ) {

		# get values from regular expression

		# Only summarize data if it is newer than our current MaxDBUnixTime
		if ($unixtime > $MaxDBUnixTime) {

			$event = $1;
			$value1 = $2;
			$value2 = $3;
			$sender = $4;
			$recipient = $5;
			$subject = $6;

			$FoundNewRow = 1;
		}
	}	
};
