The logging function of gzip_cnc
Writing messages
For each page request handled by gzip_cnc the program writes an entry into its own log file if one has been defined in its configuration.
At the end of each request processing gzip_cnc
- opens its log file in 'append' mode,
- writes a line into this file and
- closes this file immediately.
The program does not try to synchronize between several simultaneous write accesses.
Log file format
Each log file entry consists of fields in the following format:
$date $status:
$sizein ->
$sizeout (
$rate%)
$cputime sec
$url
where the individual fields have this meaning:
field name | format | explanation |
---|---|---|
$date | YYYY-MM-DD_hh:mm:ss |
date and time of this log entry's creation |
$status | string | status code of this request's processing |
$sizein | integer or "- " |
size of the original file (uncompressed) in bytes |
$sizeout | integer or "- " |
size of the cache file (compressed) in bytes |
$rate | float | compression rate of the page content in percent (or 0 if the cache file was not served) |
$cputime | float | used CPU time during processing in seconds |
$url | string | requested document URL |
Log file evaluation
gzip_cnc supplies its own evaluation program gzip_cnc_log_eval
for this log format. This program - just like gzip_cnc - is written in Perl.
Nevertheless it is not invoked as CGI script (due to a potentially rather long execution time during the evaluation of huge log files) but via command line:
perl gzip_cnc_log_eval
$filein $fileout
These two (optional) parameter values describe the path names of
- the input file (i. e. the gzip_cnc log file) and
- the output file (i. e. the HTML document created as result of this evaluation).
If only one parameter value is supplied then this value will used as input file name. For missing parameter values the default values preselected inside the program code are used; therefore the program can be placed into the same directory as the gzip_cnc log file and be executed without given parameter values.
Just like gzip_cnc you can modify the behaviour of gzip_cnc_log_eval
by setting appropriate values at the start of the program's source code. The following attributes can be set:
- the name of the input file (default value:
gzip_cnc.log
), - the name of the output file (default value:
gzip_cnc.html
), - the default value for the overhead caused by HTTP and TCP headers of request and response to be added while calculating the total transfer volume of a request (default value: 1000 bytes) and
- a flag to decide whether only a summary report or also an additional table for the compression effect related to each individual URL should be produced (this option is disabled per default as it might lead to an output file of enormous size).
Details about this are explained in depth inside the gzip_cnc_log_eval
source code.
(Michael Schröpl, 2002-08-04)