Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    analyzing a log file FROM time TO time

    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

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    The issue with log files is size.

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

    So in pseudo code.

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •