This is where perl really shines :)

Note: Im gonna next in code brackets, cause I'm lazy
Suggestions: You are able to view the data in some way shape or form, so I would + either A) figure out how to get that data out in a stream (I.e calling +an executable to provide that data on the fly for your parser) or B) instead of pulling the binary data, convert it to text, compr +ess that and munge the compressed text Determine what types of entries are in the file. Just looking at the data at hand I see at least 2 unique type of en +tries and a whole slew of other things to help with a parser. One msg from the kernel, and one msg from firewalld. Next we notice that the kernel is "Temporarily" blocking does it also log permanent blocks? does this line correlate to an earier firewalld line? The firewalld process is stating it denied a packet.. There is all sorts of juicy bits in there.. First off, the deny. What other actions can it take? Then the interface.. what other interfaces are there? The next number is interesting as I have no idea what its correl +ated to do all denies get stamped with 48? or packets on eth0, or tcp packets, or tcp packets destined for X port? Next the type what other types are coming through?..
Already a parser is starting to become fleshed out, with some simple tweaking it should be relatively simple to do, especially if all entries are one liners, which greatly reduces logic and the need for something along the lines of a quasi statemachine..

Happy hacking.. :)

/* And the Creator, against his better judgement, wrote man.c */

In reply to Re: Extracting data from a firewall log by l2kashe
in thread Extracting data from a firewall log by Anonymous Monk

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.