1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #!/usr/local/bin/perl
use strict;
use warnings;
my $apache = q{192.90.90.90 - - [10/Aug/2009:19:45:42 +0100] "GET /index.php HTTP/1.1" 100 200 "http://www.developpez.com" "Mozilla/4.0 (compatible; MSIE 7.0; Windows)"};
my $iis = q{2008-01-05 10:10:10 192.90.90.91 - GET /index.php 200 133 - Mozilla /4.0 (compatible; MSIE 7.0; Windows) http://www.developpez.com/};
if ( $apache =~ m{([\d.]+)[-\s]+\[(\w+)/(\w+)/(\d+)[\d:]+\s\+\d+\] "([A-Z]+) /(.*)" (\d+) (\d+) "(.*)" "(.*)"}){
my ($ip, $jour, $mois, $annee, $method, $page, $ret_code, $byte, $referer, $user_a) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
print "ip = $ip\njour = $jour\nmois = $mois\nannée = $annee\nmeth = $method\npage = $page\ncode = $ret_code\nby = $byte\nref = $referer\nuser = $user_a\n\n\n";
}
if ( $iis =~ m{(\d+)-(\d+)-(\d+)\s[\d:]+\s([\d.]+)\s-\s([A-Z]+)\s/(.*)\s(\d+)\s(\d+)\s-\s(.*)\s(\S*)}){
my ($annee, $mois, $jour, $ip, $method, $page, $ret_code, $byte, $referer, $user_a) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
print "ip = $ip\njour = $jour\nmois = $mois\nannée = $annee\nmeth = $method\npage = $page\ncode = $ret_code\nby = $byte\nref = $referer\nuser = $user_a\n\n\n";
} |
Partager