My question is this, Currently the out put is only ip numbers. I want to add another part to the script that shows the connections by their dns name. How would i go about doin this. I was thinkin it would be another foreach loop and doing an nslookup( i dont know the perl code for that) on each element. Any help or suggestions would be greatly appreciated. thanks, a perl newbie#!/usr/local/bin/perl # # ACLlogscan.pl -- a script to summarise ACL log files # # Set behaviour $log="H:/sys075/acls/local7.log"; # absolute path of ACL log file $ntop=40; # shows the top ten results(number can be cha +nged i.e.if # the number # is changed to 20 then you would see the top 20 r +esults) chomp ($acl=$ARGV[0]); # User can enter a specific acl numb +er if ($acl == "") { $acl=".*"}; # if nothing is entered then open(LOG , "<$log") or die; # open the log file stated in the b +ehaviour set while (<LOG>) { if (/IPACCESSLOGP: list $acl denied ([tcpudim]+) ([0-9.]+)\(([0-9]+)\ +) -> ([0-9.]+)\(([0-9]+)\), ([0-9]+) /) { # pattern ma +tching line $x=$6; $srca{$2}+=$x; $foo=sprintf("%16s -> %16s %3s port %-6s",$2,$4,$1,$5); $moo=sprintf("%3s port %-6s",$1,$5); $quad{$foo}+=$x; $port{$moo}+=$x; } } $n=0; printf ("Connection Summary:\n"); foreach $i (sort { $quad{$b} <=> $quad{$a} } keys %quad) { if ($n++ >= $ntop) { last }; printf ("%6s:%s\n", $quad{$i},$i); }
In reply to Adding an nslookup to a log script by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |