PHP Apache Web Stats Analyzer

I’ve been working on a PHP based web analytic tool designed to import web stats from Apache’s custom log format. Since I’ll be making it open source anyway, I thought I might share with you the log parser part of the program. I haven’t done any extensive testing, but here you go.

Click Me!

The code isn’t terribly complicated and it allows you to parse records using non standard formats. Use it like this:
$data = parse_record( file_get_contents( '/path/to/custom_log' ) , "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" );

And now data will contain an array of the data found in the custom log. If you have any questions leave a comment please.

Leave a Reply