Login   Register  
PHP Classes
elePHPant
Icontem

File: HOWTO

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pascal Toussaint  >  Apache Logs Reader  >  HOWTO  >  Download  
File: HOWTO
Role: Documentation
Content type: text/plain
Description: How to use the class
Class: Apache Logs Reader
Parsing and processing Apache log files
Author: By
Last change:
Date: 2004-02-05 05:13
Size: 1,222 bytes
 

Contents

Class file image Download
ApacheLogsReader is the base class to read an Apache log file.
You may extends this class for extract your own statistics.
first parameter in Constructor is the filename with path for the log file to analysis
second parameter [optional] is the LogFormat used for the log file (look for LogFormat in httpd.conf)
You can define LogFormat after call to Constructor

This is 4 pre-defined constants for <<standard>> formats used by default in the httpd.conf
	logformat_combined => "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
	logformat_common   => "%h %l %u %t \"%r\" %>s %b"
	logformat_referer  => "%{Referer}i -> %U"
	logformat_agent    => "%{User-agent}i"


ApacheLogVisits is an example of extended class for counting viewed page and visitors
You must specify what page you want analysis:
  "" (empty string) => all pages
  "/" => The home page
  "/a_page_name.php" => the page named a_page_name.php
You can also looking from a start date:
  "" (empty string) => from the beginning of the log file
  mktime(0,0,0,1,1,2004) => from the 01/01/2004
You can also looking from an end date:
  "" (empty string) => to the end of the log file
  mktime(0,0,0,1,5,2004) => to the 01/05/2004