I've a simple ASCII log file. it's got a bunch of lines like this:
2007-02-28 15:24:52,374 INFO [MMSRequestSender] Found 0 items to send + to Media Manager 2007-02-28 15:24:54,221 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382228162 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:24:55,209 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382228170 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:24:56,362 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382169066 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:24:57,496 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382221366 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:24:58,540 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382208089 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:24:59,629 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382208089 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:25:00,933 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382237543 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:25:04,037 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 381722093 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:25:06,987 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 381722093 TO MEDIAREQUESTQHISTORY. STATUS = FAILURE 2007-02-28 15:25:41,545 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382246716 TO MEDIAREQUESTQHISTORY. STATUS = SUCCESS 2007-02-28 15:25:52,375 INFO [MMSRequestSender] Found 4 items to send + to Media Manager 2007-02-28 15:26:08,050 INFO [MMSResponseListener] MOVING RECORD WITH + OCCURRENCEID: 382237436 TO MEDIAREQUESTQHISTORY. STATUS = SUCCESS
What I need to do is parse that log file every 5 minutes and find out if within the past 30 minutes there was at least 1 STATUS = SUCCESS line, and at least 1 line containing a non-zero value in a "Found 0 items to send to Media Manager" string. I can't really think of a good way / logic to parse specifically last 30 minutes of that log file.. My logic goes something like: get current date at the time the script's ran subtract 30 minutes from it, and find the line in the log file that corresponds to that timestamp .... how do i go forward on from there? i know regular expressions, thats not the problem, i just dont know how to tell the script to start looking only from that 1 line forward Any ideas ? :)

In reply to Parsing a specific section of a log file by vxp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.