#!/usr/local/bin/perl
# $Id: gwfstats.pl,v 1.15 1997/11/21 19:43:49 elkner Exp $
use GD; # Graphics class library
use Socket;
require 'getopts.pl';
require 'ctime.pl';
$Version="gwfstats 1.1";
# gwfstats: Program to create graphical statistics from HTTPd and FTPd
# Log files.
# Copyright 1997, Jens Elkner
#
# Derived from Benjamin Franz' GraphFTPWebLog 1.0 and FTPWebLog 1.0.2
#
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE.
#
# I offer it to the public domain and I ask, however, that this paragraph
# and my name be retained in any modified versions of the file you may
# make, and that you notify me of any improvements you make to the code.
#
# Use of this software in any way or in any form, source or binary,
# is not allowed in any country which prohibits disclaimers of any
# implied warranties of merchantability or fitness for a particular
# purpose or any disclaimers of a similar nature.
#
# IN NO EVENT SHALL I BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
# USE OF THIS SOFTWARE AND ITS DOCUMENTATION (INCLUDING, BUT NOT
# LIMITED TO, LOST PROFITS) EVEN IF I HAVE BEEN ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE
#-------------------------------------------------------#
# Adjust the following to match your system environment #
#-------------------------------------------------------#
# Location of the 'country-codes' file
$CountriesFile="/local/www/etc/country-codes";
# Location and name of the decompression program
# (usually '/usr/bin/zcat', '/usr/local/bin/zcat',
# '/usr/bin/gzip -cd' or '/usr/local/bin/gzip -cd')
$Zcat="/usr/local/bin/gzip -cd";
# Pattern to match for Archive Section.
# It *must* have the form (...) to allow the search
# to know the name of the archive section it matched
# '--matched pattern--' is a special substitution that says use the
# matched (...) area.
%ArchivePatterns=(
'^(/[^/]*/).*$', '--matched pattern--',
'^.*(/)$', ' html files',
'^.*(\.[Hh][Tt][Mm][Ll]?)$', ' html files',
'^.*(\.[Gg][Ii][Ff])$', ' gif graphic files',
'^.*(\.[Jj][Pp][Gg])$', ' jpg graphic files',
'^.*(\.[Pp][Nn][Gg])$', ' png graphic files',
'^.*(\.[Xx][Bb][Mm])$', ' xbm graphic files',
'^.*(\.class)$', ' Java class files',
'^(\/)[^/]*$', ' Home page',
);
#'
# Estimate the header size (in bytes) of typical responses not counted in logfile
# for NCSA/1.5.2
%RespEstimates = (
# Code Size Description
'200', 176, # A normal response header
'302', 168, # A redirect message
'304', 98, # A Not Modified response to a Conditional GET
'400', 106, # A Bad Request response message
'401', 150, # An Authorization Required response message
'403', 78, # A Forbidden response message
'404', 104, # A Not Found message
'500', 100, # A Server Error response message
'501', 100, # A Not Implemented response message
);
# Edit the second value in the line, to generate graphic files with other names
# But watch out, they have to be uniqe
%GraphName = ('HourlyByHits','HourlyByHits.gif',
'HourlyByVolume','HourlyByVolume.gif',
'DailyByHits','DailyByHits.gif',
'DailyByVolume','DailyByVolume.gif',
'TopNTopLevelDomainsByHits','TopNTopLevelDomainsByHits.gif',
'TopNTopLevelDomainsByVolume','TopNTopLevelDomainsVolume.gif',
'TopNArchivesByHits','TopNArchivesByHits.gif',
'TopNArchivesByVolume','TopNArchivesByVolume.gif',
'TopNFilesByHits','TopNFilesByHits.gif',
'TopNFilesByVolume','TopNFilesByVolume.gif',
'TopNHostsByHits','TopNHostsByHits.gif',
'TopNHostsByVolume','TopNHostsByVolume.gif',
);
#---------------------------------------------------------------------------
# Now the main program starts. No more changes are necessary !!!
#---------------------------------------------------------------------------
$newsection="
\n
\nGenerated using ".
"$Version".
" by \n".
"Jens Elkner\n".
"