I have the following line to parse:
May 20 18:57:27 1.23.25.5 %ASA-6-106100 a6 [local4.info] access-list M
+yaccess-Block permitted tcp outside/10.31.0.9(3803) -> inside/10.29.1
+0.91(4127) hit-cnt 1 300-second interval [0xa178b29d, 0x0]
I have written the following regexes to parse using memory 1-xxx for each given section:
Time: (^\S+\s\d+\s+\d+:\d+:\d+) using memory 1
Source Firewall: (\d+\.\d+\d+.\d+.\d+) using memory 1
Source part of firewall connection:
access-list\s+(\S+)\s+(\S+)\s+(\S+)\s(\S+)\/(\d+\.\d+\.\d+\.\d+)\((\d+
+)
1=source acl
2=action
3=protocol
4=source interface
5=source ip
6=source port
Destination part:
Destination:
->\s+(\S+)/(\d+\.\d+\.\d+\.\d+)\((\d+)
1=Dest Interface
2=Destination IP
3=Destination Port
\[(0x[0-9a-f]+) Matches RUle #
1=Rule#
I was wondering if my regexes are naieve and could be improved?
"Two Wheels good, Four wheels bad."
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.