Login   Register  
PHP Classes
elePHPant
Icontem

File: parse.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dom Hastings  >  PHP Log  >  parse.php  >  Download  
File: parse.php
Role: Example script
Content type: text/plain
Description: Example implementation
Class: PHP Log
Parse log files and process with separate classes
Author: By
Last change:
Date: 2009-01-12 14:49
Size: 1,013 bytes
 

Contents

Class file image Download
<?php
// make sure the script doesn't die if parsing a long log
ini_set('max_execution_time''0');

// include all the classes
require_once('class.log.php');
require_once(
'class.log.mysql.php');
require_once(
'class.log.output.php');

// see class.log.mysql.php for example table setup
// 
// log::$parser = new log_mysql(array(
//   'user' => 'mysql-username',
//   'pass' => 'My5q1_p455w0|2D',
//   'db' => 'php_log',
//   'table' => 'log',
//   'fields' => array(
//     'ip'            => 'ip',
//     'identd'        => 'identd',
//     'auth'          => 'auth',
//     'day'           => 'day',
//     'month'         => 'month',
//     'year'          => 'year',
//     'time'          => 'time',
//     'request'       => 'request',
//     'http_version'  => 'http_version',
//     'response_code' => 'response_code',
//     'size'          => 'size',
//     'referrer'      => 'referrer',
//     'navigator'     => 'navigator'
//   )
// ));
// 
log::$parser = new log_output();

log::parse('test.log');