Re: Looping through a log file

From: Arndt Jonasson (do-not-use_at_invalid.net)
Date: 03/04/05


Date: 04 Mar 2005 18:37:59 +0100


"AJ Hartley" <ajperl@mac.com> writes:
> My project is to parse a text log file created by a propietary
> publishing application and stuff the important information into a
> database. The actual parsing of the information for a single event
> using regular expressions was a slam dunk, though each line requires
> it's own expression. But I'm needing some advice with a strategy for
> looping through the file.
>
> I'm running this process every mintute or so, no more than 10 events
> can stack up in the file during that period.
>
> Each "event" in the log file may contain four or five lines of
> information. That's the parsing process mentioned above. Each event is
> concluded with a dashed line. If the next line contains nothing, we can
> exit. Otherwise the loop continues. Example:
>
> Event 1 title
> Event 1 user info
> Event 1 time stamp info
> Event 1 status info
> Event 1 file path info
> ----------------------------------------
> Event 2 title
> Event 2 user info
> Event 2 time stamp info
> Event 2 status info
> ----------------------------------------
> and so on...
>
> My challenge is to figure out how run the parsing on each chunk and
> then continue on to the next or exit as necessary based on the dashed
> line.

Is there a need to worry about log entries being written while we are
reading, so truncated entries may appear?



Relevant Pages

  • Looping through a log file
    ... My project is to parse a text log file created by a propietary ... That's the parsing process mentioned above. ... Event 1 user info ... Event 1 time stamp info ...
    (comp.lang.perl.misc)
  • Re: Novice::Help>Split IP Address(port) + count
    ... log file: What is the best combination of 'split' and regexes to do ... But the code you posted starts with opening and reading the file -- ... which is not your stated problem. ... dealing with printing the results of your line parsing to STDOUT -- ...
    (comp.lang.perl.misc)
  • Re: Random tapisrv.dll crashes, stuck in infinite loop
    ... I have log entries before and after I execute the lineEventProc from ... TSP side, and those entries are always in the log file, indicating that ... Microsoft MVP for TAPI / Windows SDK ... * Please post all messages and replies to the newsgroup so all may ...
    (microsoft.public.win32.programmer.tapi)
  • Re: IIS SMTP - Help with lots of undelivered emails
    ... emails in the log entries. ... The log format is W3C Extended Log File Format and I have pasted a partial ... i appears that the failed messages are ... not being written to the log file. ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: Showmessage equivalen durning shutdown.
    ... > inefficient, but this is debug code which you're going to toss as soon ... I had originally rejected the log file approach since the program would not ... stop there, but on reflection, I realize that log entries that are written ...
    (borland.public.delphi.language.objectpascal)