apachedb v0.14
==============

apachedb uses a mysql-db instead or additional to a log-file for logging.
I use the ability of apache to pipe transfer-logs into a program. I have 
written the following tools for converting data and logging.

log2mysql
=========
Converts and inserts an existing apache-log into a mysql-db.
It also understands a log file produced by squid. So it could also be
used to analyse squi logs.

I use this tool for synchronising the apache-db with an existing
log. Currently it recognizes 4 different log formats and inserts the
data autmatically.

- common log: this ist the log format used by default by apache
  and contains only information like hostname, request time and request.

  LogFormat for apache:
    LogFormat "%h %l %u %t \"%r\" %>s %b"

  Example line:
	====================================== access_log ===========================
	server.gaudi.at - - [23/Feb/2000:15:11:53 +0100] "/private/top_priv.php3" 200 1153
	====================================== access_log ===========================
  
- combined log
  The combined log format contains much more information. In addition to the
  common log format the referer to the page and the agent used is logged.

  LogFormat for apache:
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

  Example line:
	====================================== access_log ===========================
	server.gaudi.at - - [23/Feb/2000:15:11:53 +0100] "/private/top_priv.php3" 200 1153 "http://www.freshmeat.net" "Mozilla/4.7"
	====================================== access_log ===========================

- mod user track log
  This format is a combined log format with an additional mod user track
  field which is used to identify unique users.

  LogFormat for apache:
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{cookie}n\""

  Example line:
	====================================== access_log ===========================
	10.1.1.2 - - [23/Feb/2000:15:43:08 -0800] "GET /thumbnail.gif HTTP/1.0" 200 8502 "http://www.freshmeat.net" "Mozilla/4.51" "4598120348715"
	====================================== access_log ===========================

- squid logs
  This log format is used by squid and is like a common log but with 
  an additional state field which indicates a cache miss or hit. this 
  field isnt stored in the database.

  Example line:
	====================================== squid_log ===========================
	192.168.10.20 - - [10/Sep/2000:04:06:04 +0200] "GET http://freshmeat.net/img/pixel.gif HTTP/1.0" 0 2947 TCP_MISS:DIRECT
	====================================== squid_log ===========================

This four log formats are the only one supported by default. If you want support
for other log formats so feel free to send me a few lines of your log and i try 
to modify my script.

Usage:

$ log2mysql access_log

This version of execution prints out information about the progress 
of the import. You could use logfilter to filter the date range you 
want and to import only the selected entries. E.g. you can use a 
cron job to install the previous day.

$ cat access_log | logfilter "yesterday 00:00" "yesterday 23:59:59" | log2mysql

This statement filters the log lines except of the previous day and
pipes them into log2mysql. More about logfilter in README.logfilter

Instead of reading from a file log2mysql is also capable of reading
from STDIN

$ cat access_log | log2mysql 

or in httpd.conf

TransferLog  |/usr/sbin/log2mysql 
CustomLog    |/usr/sbin/log2mysql combined

Both calls supress output of progress information. log2mysql
runs in silent mode.

Not imported lines are stored in errrorlog-table!!


deflate.pl
==========
converts a db back to a flat file log. under development!

logfilter
=========
Is described more detailed in README.logfilter

php3-files
==========
create some statistical output. 

genreports
==========
creates CSV reports and sends them to a list of recipients and/or stores the
reports in a directory. Detailed info in README.genreports

Comments:
=========
this is still under development and any suggestions or enhancements are welcome. 
bug-reports or comments mail to e9625460@stud3.tuwien.ac.at or send an ICQ-message 
to 34550587.
