mgstat v.0.4.1

Mgstat is a simple utility to analyze log file produced by
mod_gzip (http://www.remotecommunications.com). 
It produces html reports (with png or gif charts) that shows you how 
many bytes you saved by using this excellent free Apache module. 
It produces history files so you can rotate your logs without
losing previous statistics. You can also run mgstat on
the same log file and statistics won't be doubled because
program will start from the place where previous processing ended.
You can also run mgstat on totally unsorted (date order) log file 
(that were produced for example by merging various log files);
program will run a little bit slower but will produce correct reports.
Please read some notes about history files at the end of this README.

Usage:

mgstat -l mod_gzip_log -d output_dir

mod_gzip_log - full path to a log file produced by mod_gzip.
output_dir - directory where html and history files will be created.

Below directives (in httpd.conf) produces desired log file:

LogFormat "%h %l %u %t \"%V %r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." common_with_mod_gzip_info2
CustomLog /var/log/httpd/mod_gzip_log common_with_mod_gzip_info2


To use mgstat, 3 items in your log file are necessary:

1) mod_gzip: %{mod_gzip_result}n
2) In:%{mod_gzip_input_size}n
3) Out:%{mod_gzip_output_size}n

Order is important. Other things (like "%h %l %u") could be omited.

##### IMPORTANT INFO ABOUT HISTORY FILES #####

mgstat creates 2 files in the 'output_dir':
	mgstat.hist - binary file that contains previous statistics.
	mgstat.pos - text file with last line processed and its offset 
		in a log file.

mgstat.hist holds statistics from previous runs.
mgstat.pos is needed to decide if a log file that will be analyzed in the
current run was processed before or not, to avoid doubled statistics.
If a log line saved in mgstat.pos matches line in a current log 
file at offset (counted from _beggining_) readed from mgstat.pos then 
current processing will skip already analyzed log entries.
Unless you hadn't changed your log file manually you can run
mgstat safely many times on the same log file, to update existing
reports. Of course you can periodically run mgstat before deleting log
file; mgstat.hist holds every information needed to generate summary
reports.
If you want to force mgstat to analyze log file from the beginning just
delete mgstat.pos file.
