Download
apacheLogSplit.php
Version 1.0
Cal Evans
(c) 2005 Cal Evans, All rights reserved.
Released under GPL 2.0
Description:
============
apacheLogSplit is a PHP5 program that takes an Apache COMMON log formatted
file and import it into a database for further analysis. Specifically
designed for those who want to data mine their log files but their host
can't or won't load mod_log_sql.
It's extendable to other log formats as inputs and other repositories as
outputs.
Requires:
=========
PHP 5
PHPUnit if you want to run the unit tests.
MySQL
This version should work on both Linux or Windows.
Installation:
==============
Untar into a directory.
php apacheLogSplit.php --help for options
Create your apacheLog database in mysql:
Create your apacheLog table in your apacheLog database:
create table apacheLog(
apacheLogID bigint(22) auto_increment,
remoteHost varchar(16) DEFAULT '0.0.0.0',
logName varchar(50) default '',
user varchar(50) default '',
dateStamp bigint(22) DEFAULT 0,
gmtOffSet varchar(10) DEFAULT '',
method varchar(10) DEFAULT '',
request varchar(255) DEFAULT '',
protocol varchar(10) DEFAULT '',
status integer DEFAULT 0,
bytesReturned bigint DEFAULT 0,
browser varchar(50) DEFAULT '',
referrer varchar(255) DEFAULT '',
userAgent varchar(255) default '',
primary key(apacheLogID),
key i_response(request),
key i_method(method),
key i_user(user)
);
Create your mysql that has rights to that database.
Usage:
======
php apacheLogSplit -v -u userName -p password -f /path/to/*.log
That's it, it's pretty easy.
Email me if you have questions.
=C=
|