Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Cisco Log Files: broken REGEX

by chunlou (Curate)
on Aug 22, 2003 at 00:03 UTC ( [id://285623]=note: print w/replies, xml ) Need Help??


in reply to Cisco Log Files: broken REGEX

It doesn't hurt to split up your regex for readability.
$_='Aug 21 19:00:36 [1.1.1.3.200.125] 410381: Aug 21 23:00:35 UTC: %SE +C-6-IPACCESSLOGP: list 101 denied tcp 10.161.24.153(3988) -> 10.158.2 +4.10(135), 1 packet'; / ([A-Z][a-z]+\s+\d+\s+\d+\:\d+\:\d+) # Aug 21 19:00:36 \s+ (\[\d+\.\d+\.\d+\.\d+\.\d+\.\d+\]) # [1.1.1.3.200.125] \s+ (\d+:) # 410381: \s+ ([A-Z][a-z]+\s+\d+\s+\d+\:\d+\:\d+) # Aug 21 23:00:35 \s+ ([A-Z]{3}:) # UTC: \s+ (\%SEC-\d-\w+?:) # %SEC-6-IPACCESSLOGP: \s+ (list\s\d+\s.*?) # list 101 denied tcp \s+ (\d+\.\d+\.\d+\.\d+\(\d+\)) # 10.161.24.153(3988) \s+->\s (\d+\.\d+\.\d+\.\d+\(\d+\)) # 10.158.24.10(135) \s*,\s+ (.*) # 1 packet /x; print "$1\n$2\n$3\n$4\n$5\n$6\n$7\n$8\n$9\n$10"; __END__ Aug 21 19:00:36 [1.1.1.3.200.125] 410381: Aug 21 23:00:35 UTC: %SEC-6-IPACCESSLOGP: list 101 denied tcp 10.161.24.153(3988) 10.158.24.10(135) 1 packet

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://285623]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found