Hi,
I am very new to perl pgming. I have a weblog which has a standard format as the below example
IP | remoteUser | authUser | Date/Time | Request | Status | Bytes
For example,
74.6.72.229 - - [27/Jan/2007:00:00:36 -0500] "GET /~jking/ralph.html HTTP/1.0" 404 215
the fields are seperated by space.
I need to find what are the missing pages in the website. I tried writing the below code.
I am not able to match the index of the status array with the uri array. could some one please tel me how to do this.
foreach $logfile ("sample.log")
{
open (INF, $logfile);
read INF, $file, -s INF;
close INF;
@lines = split /\n/, $file;
foreach (@lines) {
@values = split / /, $_;
$status{$values[8]}++;
$uri{$values[7]}++;
print "\n\n\n Status codes returned \n";
foreach (keys %status)
{
print "\n The status code " . $_ . " was returned ". $status{$_} . " times";
if($_ == 404)
{ print "\nMissing page or misspelt uri " . $uri($_) . "bad";}
}