I'm afraid the regexp that'd match the whole file would be too long and messy. And testing each line separately whether its something unexpected is not good enough, I need to test the lines in context.

But I like this config file with patterns and state changes idea. I think I'll use something like

( START => { '^FileCreate \d+\.\d+.\d+$' => 'START', '^---- Ticking: \d{4}/\d\d/\d\d \d\d:\d\d:\d\d - \d\d:\d\d:\d\ +d$' => 'START', '^Creating files for site ' => 'FILES' }, FILES => { '^\tCreating file ' => 'FILE', '^File generation succeeded for site ' => 'START', '^File generation failed for site ' => '--ERROR--', '^Jobs for site \d+ with parameter type "\w+" are to be proces +sed by HTTPPost or something.' => 'FILES', '^Site \d+ has posting parameters either only for single or fo +r package jobs!!!' => 'FILES', }, ... )
or maybe
( START => [ qr'^FileCreate \d+\.\d+.\d+$' => 'START', qr'^---- Ticking: \d{4}/\d\d/\d\d \d\d:\d\d:\d\d - \d\d:\d\d:\ +d\d$' => 'START', qr'^Creating files for site ' => 'FILES' ], FILES => [ qr'^\tCreating file ' => 'FILE', qr'^File generation succeeded for site ' => 'START', qr'^File generation failed for site ' => '--ERROR--', qr'^Jobs for site \d+ with parameter type "\w+" are to be proc +essed by HTTPPost or something.' => 'FILES', qr'^Site \d+ has posting parameters either only for single or +for package jobs!!!' => 'FILES', ], ... )
and read it with do() or eval().

The second has two advantages. The regexps will be precompiled and they will be tested in a dependable order. But the code will look a little awkward.

Thanks for your ideas, Jenda


In reply to Re: Re: Multiline log parsing by Jenda
in thread Multiline log parsing by Jenda

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.