Location: PHPKode > scripts > Apache 2 log file parser > apache-2-log-file-parser/example.php

 * Test script for the apache log parser class

//include the class

//The access log file
//you will want to change the path here :) and make sure that the logfile is readable by the www user (apache)
$file = '/path/to/access.log';

//Instantiate the object
$log = new apachelogparser();

//get some stats about the file
$fstats = $log->logfileStats($file);

$farr = $log->log2arr($file);
//iterate through the array above and get the info we need from each line
foreach ($farr as $line)
	//you would probably want to insert to a db or something here to do
	//datamining on the logfile, but here we will just print the output to browser
Return current item: Apache 2 log file parser