...

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



graziano
03-20-2007, 04:42 PM
Hello

I have a maillog.txt file like this

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


In this log , I want search the first line with the value "delayed rejected" AND the ip "82.235.17.23" 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.)

Thanks

aedrin
03-20-2007, 06: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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum