Created
December 19, 2012 22:26
-
-
Save snipsnipsnip/4341094 to your computer and use it in GitHub Desktop.
logwatch http diff: print IP address
This file contains hidden or 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/share/logwatch/scripts/services/http 2012-12-19 17:22:31.000000000 +0900 | |
+++ /usr/share/logwatch/scripts/services/http.orig 2011-03-31 06:57:37.000000000 +0900 | |
@@ -136,6 +136,7 @@ | |
my %hack_success =(); | |
my %needs_exam =(); | |
my %ban_ip =(); | |
+my %ip_per_url =(); | |
my %robots =(); | |
my $pattern = ""; | |
my $flag = 0; | |
@@ -556,6 +557,7 @@ | |
substr($field{url},-15,15); | |
} | |
$needs_exam{$field{http_rc}}{$fmt_url}++; | |
+ $ip_per_url{$field{http_rc}}{$fmt_url}{$field{'client_ip'}}++; | |
} | |
## | |
@@ -705,6 +707,10 @@ | |
print " $code $StatusCode{$code}\n"; | |
for my $url (sort keys %{$needs_exam{$code}}) { | |
print " $url: $needs_exam{$code}{$url} Time(s)\n"; | |
+ | |
+ while (my ($ip, $count) = each %{$ip_per_url{$code}{$url}}) { | |
+ print " $ip: $count Time(s)\n"; | |
+ } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment