View Full Version : analyzing a log file FROM time TO time

03-20-2007, 05:42 PM

I have a maillog.txt file like this

Mar-15-07 07:49:58 <ltcrosby@mailreader.com>..blah
Mar-15-07 07:52:50 <ltcrosby@mailreader.com>..blah
Mar-20-07 01:52:50 <ltcrosby@mailreader.com>..blah

In this log , I want search the first line with the value "delayed rejected" AND the ip "" ONLY in the time log interval FROM
Mar-15-07 07:49:58 TO (Mar-15-07 07:49:58)+28 hours .

Can you give me some suggestion to write this code ?
(I need this to check email rejected from my greylisting filter in 28 hours.)


03-20-2007, 07:33 PM
The issue with log files is size.

If you want, work on it on a line by line basis.

So in pseudo code.

while line = line from file
regex match date from line
if (date < startdate or date > enddate) next
parse line
end while