Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Parsing a log file

by TStanley (Canon)
on Nov 27, 2007 at 16:34 UTC ( #653300=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    2007-11-16 16:04:33    Local1.Alert    128.29.29.40    id=firewall tim
    +e="2007-11-16 16:04:08" fw=WS2000-Store 29 pri=1 proto=6(tcp) src=128
    +.29.29.200 dst=128.29.100.102 mid= 1013 mtp=  2 msg=TCP connection re
    +quest received is invalid, dropping packet Src 23 Dst 4412 from EXT n
    +/w agent=Firewall
    2007-11-16 16:05:05    Local1.Alert    128.24.24.40    id=firewall tim
    +e="2007-11-16 16:03:25" fw=WS2000-Store 24 pri=1 proto=6(tcp) src=128
    +.24.24.200 dst=128.24.100.101 mid= 1013 mtp=  2 msg=TCP connection re
    +quest received is invalid, dropping packet Src 23 Dst 4344 from EXT n
    +/w agent=Firewall
    ...
    2007-11-16 16:05:39    Local1.Alert    128.2.2.40    id=firewall time=
    +"2007-11-16 16:03:36" fw=WS2000-Store 02 pri=1 proto=6(tcp) src=128.2
    +.2.200 dst=128.2.100.106 mid= 1013 mtp=  2 msg=TCP connection request
    + received is invalid, dropping packet Src 23 Dst 4631 from EXT n/w ag
    +ent=Firewall
    2007-11-16 16:05:40    Local1.Alert    128.2.2.40    id=firewall time=
    +"2007-11-16 16:03:36" fw=WS2000-Store 02 pri=1 proto=6(tcp) src=128.2
    +.2.200 dst=128.2.100.106 mid= 1013 mtp=  2 msg=TCP connection request
    + received is invalid, dropping packet Src 23 Dst 4631 from EXT n/w ag
    +ent=Firewall
    2007-11-16 16:05:40    Local1.Alert    128.2.2.40    id=firewall time=
    +"2007-11-16 16:03:37" fw=WS2000-Store 02 pri=1 proto=6(tcp) src=128.2
    +.2.200 dst=128.2.100.106 mid= 1013 mtp=  2 msg=TCP connection request
    + received is invalid, dropping packet Src 23 Dst 4631 from EXT n/w ag
    +ent=Firewall
    
  2. or download this
    #!perl
    use strict;
    ...
    
    close INPUT;
    close CSV;
    
  3. or download this
    while(<INPUT>){
      $_=~m/msg=(.*) Src/;
    ...
    
      my @line = split /\s+/;  
      ## rest of code
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://653300]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2020-04-04 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (32 votes). Check out past polls.

    Notices?