Created
December 9, 2015 10:53
-
-
Save c7h/4083dc2d89feebdefcd2 to your computer and use it in GitHub Desktop.
logfile evaluation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
my $user_c = 0; | |
my $user_min = 0; | |
my @ip = (); | |
while(<>) { | |
if (m/(^\w+).*(\d{2}:\d{2})/) { | |
if ($1 eq 'christoph'){ | |
$user_c++; # user_zaehler erhöhen | |
$user_min =+ $2 | |
} | |
} | |
if (m/((?:\d{1,3}\.){3}\d{1,3})/){ | |
#ip-addressen | |
push @ip, $1; | |
} | |
} | |
#fertig | |
print "IP-Adressen:\n"; | |
foreach (@ip){ | |
print $_."\n"; | |
} | |
print "ipsarray @ip"; | |
print "\n"; | |
print "user christoph war $user_c mal angemeldet ($user_min lang)\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment