Initial git commit

This commit is contained in:
Darold Gilles 2012-04-06 10:47:56 +02:00
commit f882d1dd6a
24 changed files with 5377 additions and 0 deletions

120
ChangeLog Normal file
View File

@ -0,0 +1,120 @@
Revision history for SquidAnalyzer
4.2 - Sun Jan 22 16:52:27 CET 2012
- Fix network alias issue broken in last release, now data files will
store the network alias instead of the default class C network. Thank
to Fabrice Prigent for the report.
- Add support to multiple regex pattern to match networks aliases. See
network-aliases file for more information.
- User aliases are now directly changed into data files instead of html
file like before.
- Add support to multiple regex pattern to match users aliases. See
users-aliases file for more inforamtion.
- Add AnonymizeLogin configuration directives to allow full anomymization
of all users/ip. Thanks to Fabrice Prigent for the request.
- Add support to squidmime logformat, original request and reply header
are simply omitted. Squid and squidmime native format are still the
only log format supported.
UPGRADE: If you use network and/or user aliases, even if I try to preserved backward
compatibility, you may want to start with new data files as these informations are
now replaced directly into the data file instead of the HTML files. Changes only
concern file SquidAnalyzer.pm so you can just override it. There's also a new
configuration directive 'AnonymizeLogin' so you may copy/paste his definition in
default squidanalyzer.conf file.
4.1 - Tue Jan 17 19:58:35 CET 2012
- Fix data file parser issue with largest_file_size or largest_file_url
are empty. Thanks to David Walser for the report.
- Add line number when reporting bad format into a data file.
- Add missing DESTDIR variable into the allowed commande line arguments.
Thanks to David Walser for the report.
- Fix error when header file are missing as they are no more used now.
Thanks to David Walser for the report.
- Remove salogo.png from install script, it is now replaced by file
logo-squidanalyzer.png. Thanks to David Walser for the report.
- Install of README, INSTALL and Changelog is now disabled by default,
you must set DOCDIR parameter to install those files in the desired
directory. Thanks to David Walser for the request.
4.0 - Wed Dec 28 02:06:22 CET 2011
- Fix regex search failure on fake domain. Thanks to Michel Reischl for
the report.
- Add support to squid log with client dnsname instead of ip address.
Thanks to Matthew Jurgens for the patch.
- Add options --logfile (-l) and --configfile (-c) to squid-analyzer
command line argument. Thanks to Matthew Jurgens for the patch.
- Add the first and last time an url is viewed by a user on day and hour
views. Thanks to Franco Mazz for the feature request.
- Allow column sorting using the Javascript sorttable library
available at http://www.kryogenix.org/code/browser/sorttable/.
Thanks to Matthew Jurgens for the patch.
- Renamed file Changes as ChangeLog.
- Makefile.PL is now able to do a full install by creating directories
and moving files.
- Allow parsing of compressed log file. SquidAnalyzer will automaticaly
use zcat when the logfile extention ends with .gz
- The cost column now is not shown when the cost price is 0.
- Change CSS style of links.
- Complete rewrite of report menu and calendar sot that they appears on
all HTML page.
- Change License from Artistic to GPL v3.
- Remove HeaderFile, replaced by squidanalyzer.css file.
- Add --rebuild option to allow rebuilding of all html and graph output
from data files. This should be done after upgrading.
- Add ..._REFRESH_UNMODIFIED into cache HIT statistics.
UPGRADE: Even if backward compatibility is preserved on data files, the HTML and
graph have changed, so after re-installing SquidAnalyzer you may want to run
squid-analyzer with the --rebuild command line option to regenerate those files.
So run the following commands:
tar xzf SquidAnalyzer-4.0.tar.gz
cd SquidAnalyzer-4.0/
perl Makefile.PL HTMLDIR=/var/www/squidanalyzer
make && make install
/usr/local/bin/squid-analyzer --rebuild
should the normal procedure to upgrade. Change the path to the HTML output if
required.
3.1 - Mon Aug 6 12:48:14 CEST 2007
- Fix illegal division by zero errors.
- Remove extra spaces in username
3.0 Fri May 7 12:31:01 CEST 2004
- Many thanks to Alexandre Sieira for all good ideas and reports !
- Add localization support.
- Add date formatting option for localisation.
- Add French translation.
- Add Portugal/brazilan translation.
- Add custom HTML header an footer support.
2.1 Tue May 4 16:35:08 CEST 2004
- Fix Url escaping problem on users pages
- Add translation (En + Fr)
2.0 Wed Oct 15 11:40:03 CEST 2003
- This is a complete rewrite of SquidAnalyzer.
- Add configuration file.
- Add Top n of url and second level domain.
- Add alias for client ip address and/or login.
- Add exclusion from report of certain client ip
addresses, network addresses and/or auth login.
- Many bug fix.
1.1 Wed Feb 28 12:21:30 CET 2001
- Fix problem with access.log file has zero size.
- Skip log line with field lenght != 8
1.0 Wed Jan 24 13:47:14 CET 2001
- original version

128
INSTALL Normal file
View File

@ -0,0 +1,128 @@
NAME
SquidAnalyzer v4.1 - Squid access log report generation tool
REQUIREMENT
perl 5.005_03 or higher and the following Perl modules:
GD
GD::Graph
GD::TextUtil
GD::Graph::bars3d;
See GD and GD::Graph requirements for other needed libraries.
If they are not yet include in your OS distribution you can always find
them at http://search.cpan.org/
If you have Internet access from your server, you can execute the
following command to install GD::Graph::bars3d and all its dependencies.
perl -MCPAN -e 'install GD::Graph::bars3d'
Images output format is PNG so libgd must be compiled with libpng.
INSTALLATION
Generic install
If you want the package to be intalled into the Perl distribution just
do the following:
perl Makefile.PL
make
make install
Follow the instruction given at the end of install. With this default
install everything configurable will be installed under
/etc/squidanalyzer. The Perl library SquidAnalyzer.pm will be installed
under your site_perl directory and the squid-analyzer Perl script will
be copied under /usr/local/bin.
The default output directory for html reports will be
/var/www/squidanalyzer/.
Custom install
You can create your fully customized SquidAnalyzer installation by using
the Makefile.PL Perl script. Here is a sample:
perl Makefile.PL \
LOGFILE=/var/log/squid3/access.log \
BINDIR=/usr/bin \
CONFDIR=/etc \
HTMLDIR=/var/www/squidreport \
BASEURL=/squidreport \
MANDIR=/usr/man/man3 \
DOCDIR=/usr/share/doc/squidanalyzer
If you want to build a distro package, there are two other options that
you may use. The QUIET option is to tell to Makefile.PL to not show the
default post install README. The DESTDIR is to create and install all
files in a package build base directory. For example for Fedora RPM,
thing may look like that:
# Make Perl and SendmailAnalyzer distrib files
%{__perl} Makefile.PL \
INSTALLDIRS=vendor \
QUIET=1 \
LOGFILE=/var/log/squid/access.log \
BINDIR=%{_bindir} \
CONFDIR=%{_sysconfdir} \
BASEDIR=%{_localstatedir}/lib/%{uname} \
HTMLDIR=%{webdir} \
MANDIR=%{_mandir}/man3 \
DOCDIR=%{_docdir}/%{uname}-%{version} \
DESTDIR=%{buildroot} < /dev/null
See spec file in packaging/RPM for full RPM build script.
Local install
You can also have a custom installation. Just copy the SquidAnalyzer.pm
and the squid-analyzer perl script into a directory, copy and modify the
configuration file and run the script from here with the -c option.
Then copy files sorttable.js, squidanalyzer.css and
logo-squidanalyzer.png into the output directory.
Post installation
1. Modify your httpd.conf to allow access to HTML output like follow:
Alias /squidreport /var/www/squidanalyzer
<Directory /var/www/squidanalyzer>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
2. If necessary, give additional host access to SquidAnalyzer in
httpd.conf. Restart and ensure that httpd is running.
3. Browse to http://my.host.dom/squidreport/ to ensure that things are
working properly.
4. Setup a cronjob to run squid-analyzer daily or more often:
# SquidAnalyzer log reporting daily
0 2 * * * /usr/local/bin/squid-analyzer > /dev/null 2>&1
or run it manually. For more information, see README file.
You can use network name instead of network ip addresses by using the
network-aliases file. Also if you don't have authentication enable and
want to replace client ip addresses by some know user or computer you
can use the user-aliases file to do so.
See the file squidanalyzer.conf to customized your output statistics and
match your network and file system configuration.
CONFIGURATION
See README file.
AUTHOR
Gilles DAROLD <gilles@darold.net>
COPYRIGHT
Copyright (c) 2001-2012 Gilles DAROLD
This package is free software and published under the GPL v3 or above
license.

22
MANIFEST Normal file
View File

@ -0,0 +1,22 @@
Changes
MANIFEST
Makefile.PL
README
INSTALL
SquidAnalyzer.pm
excluded
network-aliases
squid-analyzer
squidanalyzer.conf
user-aliases
lang/en_US.txt
lang/fr_FR.txt
lang/pt_BR.txt
lang/en_US_footer.txt
lang/fr_FR_footer.txt
lang/pt_BR_footer.txt
lang/en_US_header.txt
lang/fr_FR_header.txt
lang/pt_BR_header.txt
sorttable.js
META.yml Module meta-data (added by MakeMaker)

13
META.yml Normal file
View File

@ -0,0 +1,13 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: SquidAnalyzer
version: 4.1
version_from: SquidAnalyzer.pm
installdirs: site
requires:
GD: 0
GD::Graph: 0
GD::Graph3d: 0
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

166
Makefile.PL Normal file
View File

@ -0,0 +1,166 @@
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
use strict;
my @ALLOWED_ARGS = ('LOGFILE','BINDIR','CONFDIR','HTMLDIR','BASEURL','DOCDIR','MANDIR','QUIET','INSTALLDIRS','DESTDIR');
# Parse command line arguments and store them as environment variables
while ($_ = shift) {
my ($k,$v) = split(/=/, $_, 2);
if (grep(/^$k$/, @ALLOWED_ARGS)) {
$ENV{$k} = $v;
}
}
$ENV{DESTDIR} =~ s/\/$//;
# Search for default log dir
my $default_log = '/var/log/squid/access.log';
if (! -d $default_log ) {
$default_log = '/var/log/squid3/access.log';
}
# Default install path
my $LOGFILE = $ENV{LOGFILE} || $default_log;
my $BINDIR = $ENV{BINDIR} || '/usr/local/bin';
my $CONFDIR = $ENV{CONFDIR} || '/etc/squidanalyzer';
my $HTMLDIR = $ENV{HTMLDIR} || '/var/www/squidanalyzer';
my $BASEURL = $ENV{BASEURL} || '/squidreport';
my $DOCDIR = $ENV{DOCDIR} || '';
my $MANDIR = $ENV{MANDIR} || '/usr/local/man/man3';
my $DESTDIR = $ENV{DESTDIR} || '';
$ENV{INSTALLDIRS} ||= 'vendor';
unless(open(INST, ">install_all.sh")) {
print "\nError: can't write post install file install_all.sh, $!\n";
exit 0;
}
print INST qq{#!/bin/sh
if [ ! -d "$DESTDIR$BINDIR" ]; then
mkdir -p $DESTDIR$BINDIR
fi
if [ ! -d "$DESTDIR$CONFDIR" ]; then
mkdir -p $DESTDIR$CONFDIR
mkdir -p $DESTDIR$CONFDIR/lang
fi
if [ ! -d "$DESTDIR$HTMLDIR" ]; then
mkdir -p $DESTDIR$HTMLDIR
fi
};
if ($DOCDIR ne '') {
print INST qq{
if [ ! -d "$DESTDIR$DOCDIR" ]; then
mkdir -p $DESTDIR$DOCDIR
fi
};
}
print INST qq{
if [ ! -d "$DESTDIR$MANDIR" ]; then
mkdir -p $DESTDIR$MANDIR
fi
if [ -e "$DESTDIR$CONFDIR/squidanalyzer.conf" ]; then
echo "File squidanalyzer.conf already exists. The new one will be copied as squidanalyzer.conf.new"
install -m 644 squidanalyzer.conf $DESTDIR$CONFDIR/squidanalyzer.conf.new
else
install -m 644 squidanalyzer.conf $DESTDIR$CONFDIR/
fi
install -m 755 squid-analyzer $DESTDIR$BINDIR/
install -m 644 sorttable.js $DESTDIR$HTMLDIR/
install -m 644 logo-squidanalyzer.png $DESTDIR$HTMLDIR/
install -m 644 squidanalyzer.css $DESTDIR$HTMLDIR/
install -m 644 lang/* $DESTDIR$CONFDIR/lang/
install -m 644 network-aliases $DESTDIR$CONFDIR/
install -m 644 user-aliases $DESTDIR$CONFDIR/
install -m 644 excluded $DESTDIR$CONFDIR/
pod2man doc/SquidAnalyzer.pod doc/squidanalyzer.3
install -m 644 doc/squidanalyzer.3 $DESTDIR$MANDIR/squidanalyzer.3
pod2text doc/SquidAnalyzer.pod README
};
if ($DOCDIR ne '') {
print INST qq{
install -m 644 README $DESTDIR$DOCDIR/
install -m 644 INSTALL $DESTDIR$DOCDIR/
install -m 644 ChangeLog $DESTDIR$DOCDIR/
};
}
if (!$ENV{QUIET}) {
print INST qq{
echo "
-----------------------------------------------------------------------------
1. Modify your httpd.conf to allow access to HTML output like follow:
Alias /squidreport $HTMLDIR
<Directory $HTMLDIR>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
2. If necessary, give additional host access to SquidAnalyzer in httpd.conf.
Restart and ensure that httpd is running.
3. Browse to http://my.host.dom/squidreport/ to ensure that things are working
properly.
4. Setup a cronjob to run squid-analyzer daily:
# SquidAnalyzer log reporting daily
0 2 * * * $BINDIR/squid-analyzer > /dev/null 2>&1
or run it manually. For more information, see $DOCDIR/README file.
-----------------------------------------------------------------------------
"
};
}
close(INST);
`chmod 755 install_all.sh`;
# Change path into the default configuration file
`perl -p -i -e 's#/etc/squidanalyzer#$CONFDIR#' squidanalyzer.conf squid-analyzer`;
`perl -p -i -e 's#^Output.*#Output $HTMLDIR#' squidanalyzer.conf`;
`perl -p -i -e 's#^LogFile.*#LogFile $LOGFILE#' squidanalyzer.conf`;
`perl -p -i -e 's#^WebUrl.*#WebUrl $BASEURL#' squidanalyzer.conf`;
my $zcat = `which zcat`;
chomp($zcat);
`perl -p -i -e 's#^\\\$ZCAT_PROG.*#\\\$ZCAT_PROG = "$zcat";#' SquidAnalyzer.pm`;
WriteMakefile(
'DISTNAME' => 'SquidAnalyzer',
'NAME' => 'SquidAnalyzer',
'VERSION_FROM' => 'SquidAnalyzer.pm',
'dist' => {
'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'
},
'AUTHOR' => 'Gilles Darold (gilles@darold.net)',
'ABSTRACT' => 'Squid log analyzer',
'DESTDIR' => $ENV{DESTDIR},
'INSTALLDIRS' => $ENV{INSTALLDIRS},
clean => {FILES => "install_all.sh"},
);
sub MY::install {
my $self = shift;
my $string = $self->MM::install;
$string =~ s/(pure_install\s+)(.*)/$1 install_all $2/;
return $string;
}
sub MY::postamble {
my $postamble = <<'END';
install_all: install_all.sh
sh install_all.sh
END
return $postamble;
}
if (!$ENV{QUIET}) {
print "Done...\n\n";
print "Now type 'make && make install'\n\n";
}

247
README Normal file
View File

@ -0,0 +1,247 @@
NAME
SquidAnalyzer v4.1 - Squid access log report generation tool
DESCRIPTION
SquidAnalyzer parse native access log format of the Squid proxy and
generate general statistics about hits, bytes, users, networks, top url
and top second level domain.
Statistic reports are oriented to user and bandwidth control, this is
not a pure cache statistics generator. SquidAnalyzer use flat files to
store data and don't need any SQL, SQL Lite or Berkeley databases.
This analyzer is incremental so it should be run in a daily cron. Take
care if you have rotate log enable to run it before rotation is done.
The HTML output need a huge size for large number of user. Here on my
pentium III 500 MHz with 15Mb of free memory, for 600 users and an
access.log of 72 Mb it takes 20 minutes to run and generate 70 Mb of
HTML output by month. If you have an older system than this and want to
save space and time, you can disable url details feature that logs and
reports statistics for every URL and domain.
REQUIREMENT
perl 5.005_03 or higher and the following Perl modules:
GD
GD::Graph
GD::TextUtil
GD::Graph::bars3d;
See GD and GD::Graph requirements for other needed libraries.
If they are not yet include in your OS distribution you can always find
them at http://search.cpan.org/
If you have Internet access from your server, you can execute the
following command to install GD::Graph::bars3d and all its dependencies.
perl -MCPAN -e 'install GD::Graph::bars3d'
Images output format is PNG so libgd must be compiled with libpng.
INSTALLATION
Generic install
If you want the package to be intalled into the Perl distribution just
do the following:
perl Makefile.PL
make
make install
Follow the instruction given at the end of install. With this default
install everything configurable will be installed under
/etc/squidanalyzer. The Perl library SquidAnalyzer.pm will be installed
under your site_perl directory and the squid-analyzer Perl script will
be copied under /usr/local/bin.
The default output directory for html reports will be
/var/www/squidanalyzer/.
Custom install
You can create your fully customized SquidAnalyzer installation by using
the Makefile.PL Perl script. Here is a sample:
perl Makefile.PL \
LOGFILE=/var/log/squid3/access.log \
BINDIR=/usr/bin \
CONFDIR=/etc \
HTMLDIR=/var/www/squidreport \
BASEURL=/squidreport \
MANDIR=/usr/man/man3 \
DOCDIR=/usr/share/doc/squidanalyzer
If you want to build a distro package, there are two other options that
you may use. The QUIET option is to tell to Makefile.PL to not show the
default post install README. The DESTDIR is to create and install all
files in a package build base directory. For example for Fedora RPM,
thing may look like that:
# Make Perl and SendmailAnalyzer distrib files
%{__perl} Makefile.PL \
INSTALLDIRS=vendor \
QUIET=1 \
LOGFILE=/var/log/squid/access.log \
BINDIR=%{_bindir} \
CONFDIR=%{_sysconfdir} \
BASEDIR=%{_localstatedir}/lib/%{uname} \
HTMLDIR=%{webdir} \
MANDIR=%{_mandir}/man3 \
DOCDIR=%{_docdir}/%{uname}-%{version} \
DESTDIR=%{buildroot} < /dev/null
See spec file in packaging/RPM for full RPM build script.
Local install
You can also have a custom installation. Just copy the SquidAnalyzer.pm
and the squid-analyzer perl script into a directory, copy and modify the
configuration file and run the script from here with the -c option.
Then copy files sorttable.js, squidanalyzer.css and
logo-squidanalyzer.png into the output directory.
Post installation
1. Modify your httpd.conf to allow access to HTML output like follow:
Alias /squidreport /var/www/squidanalyzer
<Directory /var/www/squidanalyzer>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
2. If necessary, give additional host access to SquidAnalyzer in
httpd.conf. Restart and ensure that httpd is running.
3. Browse to http://my.host.dom/squidreport/ to ensure that things are
working properly.
4. Setup a cronjob to run squid-analyzer daily or more often:
# SquidAnalyzer log reporting daily
0 2 * * * /usr/local/bin/squid-analyzer > /dev/null 2>&1
or run it manually. For more information, see README file.
You can use network name instead of network ip addresses by using the
network-aliases file. Also if you don't have authentication enable and
want to replace client ip addresses by some know user or computer you
can use the user-aliases file to do so.
See the file squidanalyzer.conf to customized your output statistics and
match your network and file system configuration.
CONFIGURATION
Unless previous version customization of SquidAnalyzer is now done by a
single configuration file squidanalyzer.conf.
Here follow the configuration directives used by Squid Analyzer.
Output output_directory
Where SquidAnalyzer should dump all HTML, data and images files. You
should give a path that can be read by a Web browser.
LogFile squid_access_log_file
Set the path to the Squid log file.
NetworkAlias network-aliases_file
Set path to the file containing network alias name. Network are show
as Ip addresses so if you want to display name instead create a file
with this format:
LOCATION_NAME IP_NETWORK_ADDRESS
Separator must be a tabulation.
You can use regex to match and group some network addresses. See
network-aliases file for examples.
UserAlias user-aliases_file
Set path to the file containing user alias name. If you don't have
auth_proxy enable users are seen as ip addresses. So if you want to
show username or computer name instead, create a file with this
format:
FULL_USERNAME IP_ADDRESS
If you have auth_proxy enable but want to replace login name by full
user name, create a file with this format:
FULL_USERNAME LOGIN_NAME
Separator for both must be a tabulation.
You can use regex to match and group some user login or ip
addresses. See user-aliases file for examples.
AnonymizeLogin 0
Set this to 1 if you want to anonymize all user login. The username
will be replaced by an unique id that change at each squid-analyzer
run. Default disable.
OrderNetwork bytes|hits|duration
OrderUser bytes|hits|duration
OrderUrl bytes|hits|duration
Used to set how SquidAnalyzer sort Network, User and Url report
screen. Value can be: bytes, hits or duration. Default is bytes.
OrderMime bytes|hits
Used to set how SquidAnalyzer sort Mime types report screen Value
can be: bytes or hits. Default is bytes.
UrlReport 0|1
Should SquidAnalyzer display user details. This will show all URL
read by user. Take care to have enougth space disk for large user.
Default is 0, no url detail report.
QuietMode 0|1
Run in quiet mode for batch processing or print debug information.
Default is 0, verbose mode.
CostPrice price/Mb
Used to set a cost of the bandwith per Mb. If you want to generate
invoice per Mb for bandwith traffic this can help you. Value 0 mean
no cost, this is the default value, the "Cost" column is not
displayed
Currency currency_abreviation
Used to set the currency of the bandwith cost. Preferably the html
special character. Default is &euro;
TopNumber number
Used to set the number of top url and second level domain to show.
Default is top 10.
Exclude exclusion_file
Used to set client ip addresses, network addresses and/or auth login
name to exclude from report. Format of the file is a login or an ip
address by line.
Lang language_file
Used to set the translation file to be used. Value must be set to a
file containing all string translated. See the lang directory for
translation files. Default is defined internally in English.
HeaderFile custom_header_file
Custom header. Must be a path to a text file containing HTML code
that will be placed just after the body tag and just before the
program name and version. Default is defined internally if this
directive is not set to a valid file.
FooterFile custom_footer_file
Custom Footer. Must be a path to a text file containing HTML code
that will be placed at the bottom of each page just before the end
if the body tag. Default is defined internally if this directive is
not set to a valid file.
AUTHOR
Gilles DAROLD <gilles@darold.net>
COPYRIGHT
Copyright (c) 2001-2012 Gilles DAROLD
This package is free software and published under the GPL v3 or above
license.

3043
SquidAnalyzer.pm Normal file

File diff suppressed because it is too large Load Diff

0
TODO Normal file
View File

275
doc/SquidAnalyzer.pod Normal file
View File

@ -0,0 +1,275 @@
=head1 NAME
SquidAnalyzer v4.1 - Squid access log report generation tool
=head1 DESCRIPTION
SquidAnalyzer parse native access log format of the Squid proxy and
generate general statistics about hits, bytes, users, networks, top
url and top second level domain.
Statistic reports are oriented to user and bandwidth control, this
is not a pure cache statistics generator. SquidAnalyzer use flat
files to store data and don't need any SQL, SQL Lite or Berkeley
databases.
This analyzer is incremental so it should be run in a daily cron.
Take care if you have rotate log enable to run it before rotation
is done.
The HTML output need a huge size for large number of user. Here on
my pentium III 500 MHz with 15Mb of free memory, for 600 users and
an access.log of 72 Mb it takes 20 minutes to run and generate 70 Mb
of HTML output by month. If you have an older system than this and
want to save space and time, you can disable url details feature
that logs and reports statistics for every URL and domain.
=head1 REQUIREMENT
perl 5.005_03 or higher and the following Perl modules:
GD
GD::Graph
GD::TextUtil
GD::Graph::bars3d;
See GD and GD::Graph requirements for other needed libraries.
If they are not yet include in your OS distribution you can always find them at http://search.cpan.org/
If you have Internet access from your server, you can execute the following command to install GD::Graph::bars3d and all its dependencies.
perl -MCPAN -e 'install GD::Graph::bars3d'
Images output format is PNG so libgd must be compiled with libpng.
=head1 INSTALLATION
=head2 Generic install
If you want the package to be intalled into the Perl distribution just
do the following:
perl Makefile.PL
make
make install
Follow the instruction given at the end of install. With this default install
everything configurable will be installed under /etc/squidanalyzer. The Perl
library SquidAnalyzer.pm will be installed under your site_perl directory and
the squid-analyzer Perl script will be copied under /usr/local/bin.
The default output directory for html reports will be /var/www/squidanalyzer/.
=head2 Custom install
You can create your fully customized SquidAnalyzer installation by using the
Makefile.PL Perl script. Here is a sample:
perl Makefile.PL \
LOGFILE=/var/log/squid3/access.log \
BINDIR=/usr/bin \
CONFDIR=/etc \
HTMLDIR=/var/www/squidreport \
BASEURL=/squidreport \
MANDIR=/usr/man/man3 \
DOCDIR=/usr/share/doc/squidanalyzer
If you want to build a distro package, there are two other options that you may use. The QUIET option is to tell to Makefile.PL to not show the default post install README. The DESTDIR is to create and install all files in a package build base directory. For example for Fedora RPM, thing may look like that:
# Make Perl and SendmailAnalyzer distrib files
%{__perl} Makefile.PL \
INSTALLDIRS=vendor \
QUIET=1 \
LOGFILE=/var/log/squid/access.log \
BINDIR=%{_bindir} \
CONFDIR=%{_sysconfdir} \
BASEDIR=%{_localstatedir}/lib/%{uname} \
HTMLDIR=%{webdir} \
MANDIR=%{_mandir}/man3 \
DOCDIR=%{_docdir}/%{uname}-%{version} \
DESTDIR=%{buildroot} < /dev/null
See spec file in packaging/RPM for full RPM build script.
=head2 Local install
You can also have a custom installation. Just copy the SquidAnalyzer.pm and the
squid-analyzer perl script into a directory, copy and modify the configuration
file and run the script from here with the -c option.
Then copy files sorttable.js, squidanalyzer.css and logo-squidanalyzer.png into
the output directory.
=head2 Post installation
1. Modify your httpd.conf to allow access to HTML output like follow:
Alias /squidreport /var/www/squidanalyzer
<Directory /var/www/squidanalyzer>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
2. If necessary, give additional host access to SquidAnalyzer in httpd.conf.
Restart and ensure that httpd is running.
3. Browse to http://my.host.dom/squidreport/ to ensure that things are working
properly.
4. Setup a cronjob to run squid-analyzer daily or more often:
# SquidAnalyzer log reporting daily
0 2 * * * /usr/local/bin/squid-analyzer > /dev/null 2>&1
or run it manually. For more information, see README file.
You can use network name instead of network ip addresses by using the
network-aliases file. Also if you don't have authentication enable and
want to replace client ip addresses by some know user or computer you
can use the user-aliases file to do so.
See the file squidanalyzer.conf to customized your output statistics and
match your network and file system configuration.
=head1 CONFIGURATION
Unless previous version customization of SquidAnalyzer is now
done by a single configuration file squidanalyzer.conf.
Here follow the configuration directives used by Squid Analyzer.
=over 4
=item Output output_directory
Where SquidAnalyzer should dump all HTML, data and images files.
You should give a path that can be read by a Web browser.
=item LogFile squid_access_log_file
Set the path to the Squid log file.
=item NetworkAlias network-aliases_file
Set path to the file containing network alias name. Network are
show as Ip addresses so if you want to display name instead
create a file with this format:
LOCATION_NAME IP_NETWORK_ADDRESS
Separator must be a tabulation.
You can use regex to match and group some network addresses. See
network-aliases file for examples.
=item UserAlias user-aliases_file
Set path to the file containing user alias name. If you don't have
auth_proxy enable users are seen as ip addresses. So if you want to
show username or computer name instead, create a file with this format:
FULL_USERNAME IP_ADDRESS
If you have auth_proxy enable but want to replace login name by full
user name, create a file with this format:
FULL_USERNAME LOGIN_NAME
Separator for both must be a tabulation.
You can use regex to match and group some user login or ip addresses. See
user-aliases file for examples.
=item AnonymizeLogin 0
Set this to 1 if you want to anonymize all user login. The username
will be replaced by an unique id that change at each squid-analyzer
run. Default disable.
=item OrderNetwork bytes|hits|duration
=item OrderUser bytes|hits|duration
=item OrderUrl bytes|hits|duration
Used to set how SquidAnalyzer sort Network, User and Url report
screen. Value can be: bytes, hits or duration. Default is bytes.
=item OrderMime bytes|hits
Used to set how SquidAnalyzer sort Mime types report screen
Value can be: bytes or hits. Default is bytes.
=item UrlReport 0|1
Should SquidAnalyzer display user details. This will show all
URL read by user. Take care to have enougth space disk for large
user. Default is 0, no url detail report.
=item QuietMode 0|1
Run in quiet mode for batch processing or print debug information.
Default is 0, verbose mode.
=item CostPrice price/Mb
Used to set a cost of the bandwith per Mb. If you want to generate
invoice per Mb for bandwith traffic this can help you. Value 0 mean
no cost, this is the default value, the "Cost" column is not displayed
=item Currency currency_abreviation
Used to set the currency of the bandwith cost. Preferably the html
special character. Default is &euro;
=item TopNumber number
Used to set the number of top url and second level domain to show.
Default is top 10.
=item Exclude exclusion_file
Used to set client ip addresses, network addresses and/or auth login
name to exclude from report. Format of the file is a login or an ip
address by line.
=item Lang language_file
Used to set the translation file to be used. Value must be set to
a file containing all string translated. See the lang directory
for translation files. Default is defined internally in English.
=item HeaderFile custom_header_file
Custom header. Must be a path to a text file containing HTML code that
will be placed just after the body tag and just before the program name
and version. Default is defined internally if this directive is not set
to a valid file.
=item FooterFile custom_footer_file
Custom Footer. Must be a path to a text file containing HTML code that
will be placed at the bottom of each page just before the end if the
body tag. Default is defined internally if this directive is not set
to a valid file.
=back
=head1 AUTHOR
Gilles DAROLD <gilles@darold.net>
=head1 COPYRIGHT
Copyright (c) 2001-2012 Gilles DAROLD
This package is free software and published under the GPL v3 or above
license.

394
doc/squidanalyzer.3 Normal file
View File

@ -0,0 +1,394 @@
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SQUIDANALYZER 1"
.TH SQUIDANALYZER 1 "2012-01-22" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
SquidAnalyzer v4.1 \- Squid access log report generation tool
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
SquidAnalyzer parse native access log format of the Squid proxy and
generate general statistics about hits, bytes, users, networks, top
url and top second level domain.
.PP
Statistic reports are oriented to user and bandwidth control, this
is not a pure cache statistics generator. SquidAnalyzer use flat
files to store data and don't need any \s-1SQL\s0, \s-1SQL\s0 Lite or Berkeley
databases.
.PP
This analyzer is incremental so it should be run in a daily cron.
Take care if you have rotate log enable to run it before rotation
is done.
.PP
The \s-1HTML\s0 output need a huge size for large number of user. Here on
my pentium \s-1III\s0 500 MHz with 15Mb of free memory, for 600 users and
an access.log of 72 Mb it takes 20 minutes to run and generate 70 Mb
of \s-1HTML\s0 output by month. If you have an older system than this and
want to save space and time, you can disable url details feature
that logs and reports statistics for every \s-1URL\s0 and domain.
.SH "REQUIREMENT"
.IX Header "REQUIREMENT"
perl 5.005_03 or higher and the following Perl modules:
.PP
.Vb 4
\& GD
\& GD::Graph
\& GD::TextUtil
\& GD::Graph::bars3d;
.Ve
.PP
See \s-1GD\s0 and GD::Graph requirements for other needed libraries.
.PP
If they are not yet include in your \s-1OS\s0 distribution you can always find them at http://search.cpan.org/
.PP
If you have Internet access from your server, you can execute the following command to install GD::Graph::bars3d and all its dependencies.
.PP
.Vb 1
\& perl \-MCPAN \-e \*(Aqinstall GD::Graph::bars3d\*(Aq
.Ve
.PP
Images output format is \s-1PNG\s0 so libgd must be compiled with libpng.
.SH "INSTALLATION"
.IX Header "INSTALLATION"
.SS "Generic install"
.IX Subsection "Generic install"
If you want the package to be intalled into the Perl distribution just
do the following:
.PP
.Vb 3
\& perl Makefile.PL
\& make
\& make install
.Ve
.PP
Follow the instruction given at the end of install. With this default install
everything configurable will be installed under /etc/squidanalyzer. The Perl
library SquidAnalyzer.pm will be installed under your site_perl directory and
the squid-analyzer Perl script will be copied under /usr/local/bin.
.PP
The default output directory for html reports will be /var/www/squidanalyzer/.
.SS "Custom install"
.IX Subsection "Custom install"
You can create your fully customized SquidAnalyzer installation by using the
Makefile.PL Perl script. Here is a sample:
.PP
.Vb 8
\& perl Makefile.PL \e
\& LOGFILE=/var/log/squid3/access.log \e
\& BINDIR=/usr/bin \e
\& CONFDIR=/etc \e
\& HTMLDIR=/var/www/squidreport \e
\& BASEURL=/squidreport \e
\& MANDIR=/usr/man/man3 \e
\& DOCDIR=/usr/share/doc/squidanalyzer
.Ve
.PP
If you want to build a distro package, there are two other options that you may use. The \s-1QUIET\s0 option is to tell to Makefile.PL to not show the default post install \s-1README\s0. The \s-1DESTDIR\s0 is to create and install all files in a package build base directory. For example for Fedora \s-1RPM\s0, thing may look like that:
.PP
.Vb 12
\& # Make Perl and SendmailAnalyzer distrib files
\& %{_\|_perl} Makefile.PL \e
\& INSTALLDIRS=vendor \e
\& QUIET=1 \e
\& LOGFILE=/var/log/squid/access.log \e
\& BINDIR=%{_bindir} \e
\& CONFDIR=%{_sysconfdir} \e
\& BASEDIR=%{_localstatedir}/lib/%{uname} \e
\& HTMLDIR=%{webdir} \e
\& MANDIR=%{_mandir}/man3 \e
\& DOCDIR=%{_docdir}/%{uname}\-%{version} \e
\& DESTDIR=%{buildroot} < /dev/null
.Ve
.PP
See spec file in packaging/RPM for full \s-1RPM\s0 build script.
.SS "Local install"
.IX Subsection "Local install"
You can also have a custom installation. Just copy the SquidAnalyzer.pm and the
squid-analyzer perl script into a directory, copy and modify the configuration
file and run the script from here with the \-c option.
.PP
Then copy files sorttable.js, squidanalyzer.css and logo\-squidanalyzer.png into
the output directory.
.SS "Post installation"
.IX Subsection "Post installation"
1. Modify your httpd.conf to allow access to \s-1HTML\s0 output like follow:
.PP
.Vb 8
\& Alias /squidreport /var/www/squidanalyzer
\& <Directory /var/www/squidanalyzer>
\& Options \-Indexes FollowSymLinks MultiViews
\& AllowOverride None
\& Order deny,allow
\& Deny from all
\& Allow from 127.0.0.1
\& </Directory>
.Ve
.PP
2. If necessary, give additional host access to SquidAnalyzer in httpd.conf.
Restart and ensure that httpd is running.
.PP
3. Browse to http://my.host.dom/squidreport/ to ensure that things are working
properly.
.PP
4. Setup a cronjob to run squid-analyzer daily or more often:
.PP
.Vb 2
\& # SquidAnalyzer log reporting daily
\& 0 2 * * * /usr/local/bin/squid\-analyzer > /dev/null 2>&1
.Ve
.PP
or run it manually. For more information, see \s-1README\s0 file.
.PP
You can use network name instead of network ip addresses by using the
network-aliases file. Also if you don't have authentication enable and
want to replace client ip addresses by some know user or computer you
can use the user-aliases file to do so.
.PP
See the file squidanalyzer.conf to customized your output statistics and
match your network and file system configuration.
.SH "CONFIGURATION"
.IX Header "CONFIGURATION"
Unless previous version customization of SquidAnalyzer is now
done by a single configuration file squidanalyzer.conf.
.PP
Here follow the configuration directives used by Squid Analyzer.
.IP "Output output_directory" 4
.IX Item "Output output_directory"
Where SquidAnalyzer should dump all \s-1HTML\s0, data and images files.
You should give a path that can be read by a Web browser.
.IP "LogFile squid_access_log_file" 4
.IX Item "LogFile squid_access_log_file"
Set the path to the Squid log file.
.IP "NetworkAlias network\-aliases_file" 4
.IX Item "NetworkAlias network-aliases_file"
Set path to the file containing network alias name. Network are
show as Ip addresses so if you want to display name instead
create a file with this format:
.Sp
.Vb 1
\& LOCATION_NAME IP_NETWORK_ADDRESS
.Ve
.Sp
Separator must be a tabulation.
.Sp
You can use regex to match and group some network addresses. See
network-aliases file for examples.
.IP "UserAlias user\-aliases_file" 4
.IX Item "UserAlias user-aliases_file"
Set path to the file containing user alias name. If you don't have
auth_proxy enable users are seen as ip addresses. So if you want to
show username or computer name instead, create a file with this format:
.Sp
.Vb 1
\& FULL_USERNAME IP_ADDRESS
.Ve
.Sp
If you have auth_proxy enable but want to replace login name by full
user name, create a file with this format:
.Sp
.Vb 1
\& FULL_USERNAME LOGIN_NAME
.Ve
.Sp
Separator for both must be a tabulation.
.Sp
You can use regex to match and group some user login or ip addresses. See
user-aliases file for examples.
.IP "AnonymizeLogin 0" 4
.IX Item "AnonymizeLogin 0"
Set this to 1 if you want to anonymize all user login. The username
will be replaced by an unique id that change at each squid-analyzer
run. Default disable.
.IP "OrderNetwork bytes|hits|duration" 4
.IX Item "OrderNetwork bytes|hits|duration"
.PD 0
.IP "OrderUser bytes|hits|duration" 4
.IX Item "OrderUser bytes|hits|duration"
.IP "OrderUrl bytes|hits|duration" 4
.IX Item "OrderUrl bytes|hits|duration"
.PD
Used to set how SquidAnalyzer sort Network, User and Url report
screen. Value can be: bytes, hits or duration. Default is bytes.
.IP "OrderMime bytes|hits" 4
.IX Item "OrderMime bytes|hits"
Used to set how SquidAnalyzer sort Mime types report screen
Value can be: bytes or hits. Default is bytes.
.IP "UrlReport 0|1" 4
.IX Item "UrlReport 0|1"
Should SquidAnalyzer display user details. This will show all
\&\s-1URL\s0 read by user. Take care to have enougth space disk for large
user. Default is 0, no url detail report.
.IP "QuietMode 0|1" 4
.IX Item "QuietMode 0|1"
Run in quiet mode for batch processing or print debug information.
Default is 0, verbose mode.
.IP "CostPrice price/Mb" 4
.IX Item "CostPrice price/Mb"
Used to set a cost of the bandwith per Mb. If you want to generate
invoice per Mb for bandwith traffic this can help you. Value 0 mean
no cost, this is the default value, the \*(L"Cost\*(R" column is not displayed
.IP "Currency currency_abreviation" 4
.IX Item "Currency currency_abreviation"
Used to set the currency of the bandwith cost. Preferably the html
special character. Default is &euro;
.IP "TopNumber number" 4
.IX Item "TopNumber number"
Used to set the number of top url and second level domain to show.
Default is top 10.
.IP "Exclude exclusion_file" 4
.IX Item "Exclude exclusion_file"
Used to set client ip addresses, network addresses and/or auth login
name to exclude from report. Format of the file is a login or an ip
address by line.
.IP "Lang language_file" 4
.IX Item "Lang language_file"
Used to set the translation file to be used. Value must be set to
a file containing all string translated. See the lang directory
for translation files. Default is defined internally in English.
.IP "HeaderFile custom_header_file" 4
.IX Item "HeaderFile custom_header_file"
Custom header. Must be a path to a text file containing \s-1HTML\s0 code that
will be placed just after the body tag and just before the program name
and version. Default is defined internally if this directive is not set
to a valid file.
.IP "FooterFile custom_footer_file" 4
.IX Item "FooterFile custom_footer_file"
Custom Footer. Must be a path to a text file containing \s-1HTML\s0 code that
will be placed at the bottom of each page just before the end if the
body tag. Default is defined internally if this directive is not set
to a valid file.
.SH "AUTHOR"
.IX Header "AUTHOR"
Gilles \s-1DAROLD\s0 <gilles@darold.net>
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c) 2001\-2012 Gilles \s-1DAROLD\s0
.PP
This package is free software and published under the \s-1GPL\s0 v3 or above
license.

10
excluded Normal file
View File

@ -0,0 +1,10 @@
#------------------------------------------------------------------------------
# File used to defined which client ip address, network regex address and/or
# auth login to exclude from report. Typically if your boss or you don't
# want to appears in the statistic report add your ip address or login to
# this file. One by line. See example bellow:
#------------------------------------------------------------------------------
#192.168.1.2
#myloginstr
#^10\.169\.1\.
#guestlogin\d+

92
lang/en_US.txt Normal file
View File

@ -0,0 +1,92 @@
#------------------------------------------------------------------------------
# This is the translation file of SquidAnalyzer program. The first column
# represente the program access key to translated string and the second
# column is the translated string itself.
# Keys should not be modified and are case sensitive. The column separator
# is the tabulation character.
#
# Specials tags %s and %d in the translated string are uses by the program to
# replace dynamics values. Following the language their place in the string
# may vary.
#
# Author: Gilles Darold
#------------------------------------------------------------------------------
01 Jan
02 Feb
03 Mar
04 Apr
05 May
06 Jun
07 Jul
08 Aug
09 Sep
10 Oct
11 Nov
12 Dec
Requests Requests
Bytes Bytes
Megabytes Mega bytes
Total Total
Years Years
Months Months
Days Days
Hit Hit
Miss Miss
Cost Cost
Users Users
Sites Sites
Domains Domains
Requests_graph Requests
Megabytes_graph Mega bytes
Months_graph Months
Days_graph Days
Hit_graph Hit
Miss_graph Miss
Total_graph Total
Domains_graph Domains
Users_help Total number of different users for this period
Sites_help Total number of different visited sites for this period
Domains_help Total number of different second level visited domain for this period
Hit_help Objects found in cache
Miss_help Objects not found in cache
Cost_help 1 Mega byte =
Generation Report generated on
Main_cache_title Cache Statistics
Cache_title Cache Statistics on
Stat_label Stat
Mime_link Mime Types
Network_link Networks
User_link Users
Top_url_link Top Urls
Top_domain_link Top Domains
Back_link Back
Graph_cache_hit_title %s Requests statistics on
Graph_cache_byte_title %s Mega Bytes statistics on
Hourly Hourly
Hours Hours
Daily Daily
Days Days
Monthly Monthly
Months Months
Mime_title Mime Type Statistics on
Mime_number Number of mime type
Network_title Network Statistics on
Network_number Number of network
Duration Duration
Time Time
Largest Largest
Url Url
User_title User Statistics on
User_number Number of user
Url_Hits_title Top %d Url hits on
Url_Bytes_title Top %d Url bytes on
Url_Duration_title Top %d Url duration on
Url_number Number of Url
Domain_Hits_title Top %d Domain hits on
Domain_Bytes_title Top %d Domain bytes on
Domain_Duration_title Top %d Domain duration on
Domain_number Number of domain
Domain_graph_hits_title Domain Hits Statistics on
Domain_graph_bytes_title Domain Bytes Statistiques on
First_time First hit
Last_time Last hit

3
lang/en_US_footer.txt Normal file
View File

@ -0,0 +1,3 @@
<hr>
This file was generated by <a href="http://squidanalyzer.darold.net/">SquidAnalyzer %VERSION%</a>

92
lang/fr_FR.txt Normal file
View File

@ -0,0 +1,92 @@
#------------------------------------------------------------------------------
# Fichier de traduction des chaines de caractères du programme SquidAnalyzer.
# La premiere colonne correspond aux clés d'accès par le programme aux
# traductions données dans la deuxieme colonne. Les clés ne doivent pas être
# modifiés et la casse doit etre repectée. Le séparateur de colonne est la
# tabulation.
#
# Les tags %s et %d dans les chaines de traduction correspondent aux valeurs
# dynamiques subtituées par le programme. Suivant la langue utilisée leur
# emplacement peut être modifié.
#
# Auteur: Gilles Darold
#------------------------------------------------------------------------------
01 Jan
02 Fév
03 Mar
04 Avr
05 Mai
06 Jui
07 Jui
08 Aou
09 Sep
10 Oct
11 Nov
12 Déc
Requests Requêtes
Bytes Octets
Megabytes Mega octets
Total Total
Years Années
Months Mois
Days Jours
Hit Trouvés
Miss Manquants
Cost Coût
Users Utilisateurs
Sites Sites
Domains Domaines
Requests_graph Requêtes
Megabytes_graph Mega octets
Months_graph Mois
Days_graph Jours
Hit_graph Trouves
Miss_graph Manquants
Total_graph Total
Domains_graph Domaines
Users_help Nombre total d'utilisateurs differents pendant cette période
Sites_help Nombre total de sites differents visités pendant cette période
Domains_help Nombre total de domaines visités pendant cette période
Hit_help Objets trouvés dans le cache
Miss_help Objets non trouvés dans le cache
Cost_help 1 Mega octet =
Generation Rapport généré
Main_cache_title Statistiques du cache
Cache_title Statistiques du cache pour
Stat_label Stat
Mime_link Mime Types
Network_link Réseaux
User_link Utilisateurs
Top_url_link Top Urls
Top_domain_link Top Domaines
Back_link Retour
Graph_cache_hit_title Statistiques %s des requêtes pour
Graph_cache_byte_title Statistiques %s des transferts pour
Hourly par heure
Hours Heures
Daily Quotidiennes
Days Jours
Monthly Mensuelles
Months Mois
Mime_title Statistiques Mimes Types pour
Mime_number Nombre de mimes types
Network_title Statistiques Réseaux pour
Network_number Nombre de réseaux
Duration Durée
Time Temps
Largest Plus gros transfert
Url Url
User_title Statistiques utilisateurs pour
User_number Nombre d'utilisateurs
Url_Hits_title Url Top %d des requêtes pour
Url_Bytes_title Url Top %d des transferts pour
Url_Duration_title Url Top %d par durée pour
Url_number Nombre d'Url
Domain_Hits_title Domaines Top %d des requêtes pour
Domain_Bytes_title Domaines Top %d des transferts pour
Domain_Duration_title Domaines Top %d par durée pour
Domain_number Nombre de domaines
Domain_graph_hits_title Statistiques des requêtes par domaines pour
Domain_graph_bytes_title Statistiques des transferts par domaines pour
First_time Première visite
Last_time Dernière visite

3
lang/fr_FR_footer.txt Normal file
View File

@ -0,0 +1,3 @@
<hr>
Ce fichier a été généré par <a href="http://squidanalyzer.darold.net/">SquidAnalyzer %VERSION%</a>

93
lang/pt_BR.txt Normal file
View File

@ -0,0 +1,93 @@
#------------------------------------------------------------------------------
# This is the translation file of SquidAnalyzer program. The first column
# represente the program access key to translated string and the second
# column is the translated string itself.
# Keys should not be modified and are case sensitive. The column separator
# is the tabulation character.
#
# Specials tags %s and %d in the translated string are uses by the program to
# replace dynamics values. Following the language their place in the string
# may vary.
#
# Author: Alexandre Sieira <alexandre.sieira@ciphersec.com.br>
# Last change: May 7th, 2004.
#------------------------------------------------------------------------------
01 Jan
02 Fev
03 Mar
04 Abr
05 Mai
06 Jun
07 Jul
08 Ago
09 Set
10 Out
11 Nov
12 Dez
Requests Acessos
Bytes Bytes
Megabytes Mbytes
Total Total
Years Anos
Months Meses
Days Dias
Hit Hit
Miss Miss
Cost Custo
Users Usu&aacute;rios
Sites Sites
Domains Dom&iacute;nios
Requests_graph Acessos
Megabytes_graph Mbytes
Months_graph Meses
Days_graph Dias
Hit_graph Hit
Miss_graph Miss
Total_graph Total
Domains_graph Domínios
Users_help N&uacute;mero total de usu&aacute;rios distintos neste per&iacute;odo.
Sites_help N&uacute;mero total de sites distintos visitados neste per&iacute;odo.
Domains_help N&uacute;mero total de dom&iacute;nios de segundo n&iacute;vel distintos visitados neste per&iacute;odo.
Hit_help Objetos presentes no proxy.
Miss_help Objetos n&atilde;o encontrados no proxy e buscados externamente.
Cost_help 1 Mbyte =
Generation Relat&oacute;rio gerado em
Main_cache_title Estat&iacute;sticas do Proxy
Cache_title Estat&iacute;sticas do Proxy em
Stat_label estat&iacute;sticas
Network_link Redes
User_link Usu&aacute;rios
Top_url_link Top URLs
Top_domain_link Top Dom&iacute;nios
Mime_link Tipos MIME
Back_link Voltar
Graph_cache_hit_title Acessos %s em
Graph_cache_byte_title Bytes Transferidos %s em
Hourly por Hora
Hours Horas
Daily por Dia
Days Dias
Monthly por Mês
Months Meses
Mime_title Estat&iacute;sticas de tipo MIME em
Mime_number N&uacute;mero de tipos MIME
Network_title Estat&iacute;sticas de Rede em
Network_number N&uacute;mero de redes
Duration Tempo
Time Tempo
Largest Maior
Url URL
User_title Estat&iacute;sticas de usu&aacute;rios em
User_number N&uacute;mero de usu&aacute;rios
Url_Hits_title As Top %d URLs por n&uacute;mero de acessos em
Url_Bytes_title As Top %d URLs por bytes transferidos em
Url_Duration_title As Top %d URLs por tempo de transfer&ecirc;ncia em
Url_number N&uacute;mero de URLs
Domain_Hits_title Os Top %d dom&iacute;nios por n&uacute;mero de acessos em
Domain_Bytes_title Os Top %d dom&iacute;nios por bytes transferidos em
Domain_Duration_title Os Top %d dom&iacute;nios por tempo de transfer&ecirc;ncia em
Domain_number N&uacute;mero de dom&iacute;nios
Domain_graph_hits_title Acessos a Domínios em
Domain_graph_bytes_title Bytes Transferidos de Domínios em
First_time Primeira visita
Last_time Ultima visita

2
lang/pt_BR_footer.txt Normal file
View File

@ -0,0 +1,2 @@
<hr>
Este arquivo foi gerado por <a href="http://squidanalyzer.darold.net/">SquidAnalyzer %VERSION%</a>.

BIN
logo-squidanalyzer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

10
network-aliases Normal file
View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------
# Squid Analyzer Network Alias configuration file
# FORMAT : NETWORK_NAME NETWORK_REGEX1,NETWORK_REGEX2,...
# Field separator must be one or more tabulation. See examples below.
#
#-------------------------------------------------------------------------------
#Home Network 192\.168\.1\.
#Associated Networks ^10\.169\.[2-4]\.,^10\.169\.[7-9]\.
#ClassB Network ^10\.172\.

493
sorttable.js Normal file
View File

@ -0,0 +1,493 @@
/*
SortTable
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
Instructions:
Download this file
Add <script src="sorttable.js"></script> to your HTML
Add class="sortable" to any table you'd like to make sortable
Click on the headers to sort
Thanks to many, many people for contributions and suggestions.
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
This basically means: do what you want with it.
*/
var stIsIE = /*@cc_on!@*/false;
sorttable = {
init: function() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (_timer) clearInterval(_timer);
if (!document.createElement || !document.getElementsByTagName) return;
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
forEach(document.getElementsByTagName('table'), function(table) {
if (table.className.search(/\bsortable\b/) != -1) {
sorttable.makeSortable(table);
}
});
},
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
the.appendChild(table.rows[0]);
table.insertBefore(the,table.firstChild);
}
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
// for backwards compatibility, move them to tfoot (creating it if needed).
sortbottomrows = [];
for (var i=0; i<table.rows.length; i++) {
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
sortbottomrows[sortbottomrows.length] = table.rows[i];
}
}
if (sortbottomrows) {
if (table.tFoot == null) {
// table doesn't have a tfoot. Create one.
tfo = document.createElement('tfoot');
table.appendChild(tfo);
}
for (var i=0; i<sortbottomrows.length; i++) {
tfo.appendChild(sortbottomrows[i]);
}
delete sortbottomrows;
}
// work through each column and calculate its type
headrow = table.tHead.rows[0].cells;
for (var i=0; i<headrow.length; i++) {
// manually override the type with a sorttable_type attribute
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
if (mtch) { override = mtch[1]; }
if (mtch && typeof sorttable["sort_"+override] == 'function') {
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
} else {
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
}
// make it clickable to sort
headrow[i].sorttable_columnindex = i;
headrow[i].sorttable_tbody = table.tBodies[0];
dean_addEvent(headrow[i],"click", function(e) {
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
// if we're already sorted by this column, just
// reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted',
'sorttable_sorted_reverse');
this.removeChild(document.getElementById('sorttable_sortfwdind'));
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
this.appendChild(sortrevind);
return;
}
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
// if we're already sorted by this column in reverse, just
// re-reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted_reverse',
'sorttable_sorted');
this.removeChild(document.getElementById('sorttable_sortrevind'));
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
this.appendChild(sortfwdind);
return;
}
// remove sorttable_sorted classes
theadrow = this.parentNode;
forEach(theadrow.childNodes, function(cell) {
if (cell.nodeType == 1) { // an element
cell.className = cell.className.replace('sorttable_sorted_reverse','');
cell.className = cell.className.replace('sorttable_sorted','');
}
});
sortfwdind = document.getElementById('sorttable_sortfwdind');
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
sortrevind = document.getElementById('sorttable_sortrevind');
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
this.className += ' sorttable_sorted';
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
this.appendChild(sortfwdind);
// build an array to sort. This is a Schwartzian transform thing,
// i.e., we "decorate" each row with the actual sort key,
// sort based on the sort keys, and then put the rows back in order
// which is a lot faster because you only do getInnerText once per row
row_array = [];
col = this.sorttable_columnindex;
rows = this.sorttable_tbody.rows;
for (var j=0; j<rows.length; j++) {
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
}
/* If you want a stable sort, uncomment the following line */
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
/* and comment out this one */
row_array.sort(this.sorttable_sortfunction);
tb = this.sorttable_tbody;
for (var j=0; j<row_array.length; j++) {
tb.appendChild(row_array[j][1]);
}
delete row_array;
});
}
}
},
guessType: function(table, column) {
// guess the type of a column based on its first non-blank row
sortfn = sorttable.sort_alpha;
for (var i=0; i<table.tBodies[0].rows.length; i++) {
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
if (text != '') {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
return sorttable.sort_numeric;
}
// check for a date: dd/mm/yyyy or dd/mm/yy
// can have / or . or - as separator
// can be mm/dd as well
possdate = text.match(sorttable.DATE_RE)
if (possdate) {
// looks like a date
first = parseInt(possdate[1]);
second = parseInt(possdate[2]);
if (first > 12) {
// definitely dd/mm
return sorttable.sort_ddmm;
} else if (second > 12) {
return sorttable.sort_mmdd;
} else {
// looks like a date, but we can't tell which, so assume
// that it's dd/mm (English imperialism!) and keep looking
sortfn = sorttable.sort_ddmm;
}
}
}
}
return sortfn;
},
getInnerText: function(node) {
// gets the text we want to use for sorting for a cell.
// strips leading and trailing whitespace.
// this is *not* a generic getInnerText function; it's special to sorttable.
// for example, you can override the cell text with a customkey attribute.
// it also gets .value for <input> fields.
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.innerText != 'undefined' && !hasInputs) {
return node.innerText.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.text != 'undefined' && !hasInputs) {
return node.text.replace(/^\s+|\s+$/g, '');
}
else {
switch (node.nodeType) {
case 3:
if (node.nodeName.toLowerCase() == 'input') {
return node.value.replace(/^\s+|\s+$/g, '');
}
case 4:
return node.nodeValue.replace(/^\s+|\s+$/g, '');
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += sorttable.getInnerText(node.childNodes[i]);
}
return innerText.replace(/^\s+|\s+$/g, '');
break;
default:
return '';
}
}
},
reverse: function(tbody) {
// reverse the rows in a tbody
newrows = [];
for (var i=0; i<tbody.rows.length; i++) {
newrows[newrows.length] = tbody.rows[i];
}
for (var i=newrows.length-1; i>=0; i--) {
tbody.appendChild(newrows[i]);
}
delete newrows;
},
/* sort functions
each sort function takes two parameters, a and b
you are comparing a[0] and b[0] */
sort_numeric: function(a,b) {
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
if (isNaN(aa)) aa = 0;
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
if (isNaN(bb)) bb = 0;
return aa-bb;
},
sort_alpha: function(a,b) {
if (a[0]==b[0]) return 0;
if (a[0]<b[0]) return -1;
return 1;
},
sort_ddmm: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
sort_mmdd: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
// see: http://en.wikipedia.org/wiki/Cocktail_sort
// thanks to Joseph Nahmias
var b = 0;
var t = list.length - 1;
var swap = true;
while(swap) {
swap = false;
for(var i = b; i < t; ++i) {
if ( comp_func(list[i], list[i+1]) > 0 ) {
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
swap = true;
}
} // for
t--;
if (!swap) break;
for(var i = t; i > b; --i) {
if ( comp_func(list[i], list[i-1]) < 0 ) {
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
swap = true;
}
} // for
b++;
} // while(swap)
}
}
/* ******************************************************************
Supporting functions: bundled here to avoid depending on a library
****************************************************************** */
// Dean Edwards/Matthias Miller/John Resig
/* for Mozilla/Opera9 */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", sorttable.init, false);
}
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
sorttable.init(); // call the onload handler
}
};
/*@end @*/
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
var _timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
sorttable.init(); // call the onload handler
}
}, 10);
}
/* for other browsers */
window.onload = sorttable.init;
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/
function dean_addEvent(element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;
function removeEvent(element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else {
// delete the event handler from the hash table
if (element.events && element.events[type]) {
delete element.events[type][handler.$$guid];
}
}
};
function handleEvent(event) {
var returnValue = true;
// grab the event object (IE uses a global event object)
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
// get a reference to the hash table of event handlers
var handlers = this.events[event.type];
// execute each event handler
for (var i in handlers) {
this.$$handleEvent = handlers[i];
if (this.$$handleEvent(event) === false) {
returnValue = false;
}
}
return returnValue;
};
function fixEvent(event) {
// add W3C standard event methods
event.preventDefault = fixEvent.preventDefault;
event.stopPropagation = fixEvent.stopPropagation;
return event;
};
fixEvent.preventDefault = function() {
this.returnValue = false;
};
fixEvent.stopPropagation = function() {
this.cancelBubble = true;
}
// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
forEach, version 1.0
Copyright 2006, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
Array.forEach = function(array, block, context) {
for (var i = 0; i < array.length; i++) {
block.call(context, array[i], i, array);
}
};
}
// generic enumeration
Function.prototype.forEach = function(object, block, context) {
for (var key in object) {
if (typeof this.prototype[key] == "undefined") {
block.call(context, object[key], key, object);
}
}
};
// character enumeration
String.forEach = function(string, block, context) {
Array.forEach(string.split(""), function(chr, index) {
block.call(context, chr, index, string);
});
};
// globally resolve forEach enumeration
var forEach = function(object, block, context) {
if (object) {
var resolve = Object; // default
if (object instanceof Function) {
// functions have a "length" property
resolve = Function;
} else if (object.forEach instanceof Function) {
// the object implements a custom forEach method so use that
object.forEach(block, context);
return;
} else if (typeof object == "string") {
// the object is a string
resolve = String;
} else if (typeof object.length == "number") {
// the object is array-like
resolve = Array;
}
resolve.forEach(object, block, context);
}
};

71
squid-analyzer Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/perl
#
# Perl frontend to SquidAnalyzer.pm.
#
use strict;
use SquidAnalyzer;
use Getopt::Long;
$| = 1;
my $DEFAULT_CONFFILE = '/etc/squidanalyzer/squidanalyzer.conf';
my $logfile = '';
my $configfile = '';
my $help = '';
my $rebuild = '';
# get the command line parameters
my $result = GetOptions (
"l|logfile=s" => \$logfile,
"c|configfile=s" => \$configfile,
"h|help" => \$help,
"r|rebuild!" => \$rebuild,
);
# Allow backward compatibility with release < 4.1
$configfile = $ARGV[0] if (($#ARGV == 0) && $ARGV[0]);
if (($#ARGV < 0) && -e $DEFAULT_CONFFILE) {
$configfile = $DEFAULT_CONFFILE;
}
if (!$configfile || $help) {
&usage;
exit;
}
# Instanciate SquidAnalyzer.pm perl module
my $sa = new SquidAnalyzer($configfile, $logfile);
# Run parsing
$sa->parseFile();
# Recover month and year statistics from day stats
if ($rebuild) {
$sa->{history_time} = '';
}
# Generate graphics and html
$sa->buildHTML();
exit(0);
sub usage
{
print qq{
Usage: squid-analyzer [ -c squidanalyzer.conf ] [-l logfile]
-l | --logfile filename : path to the Squid logfile to parse.
By default: /var/log/squid/access.log
-c | --configfile filename : path to the SquidAnalyzer configuration file.
By default: /etc/squidanalyzer.conf
-r | --rebuild : use this option to rebuild all html and graphs
output from all data files.
-h | --help : show this message and exit.
};
exit 0;
}

77
squidanalyzer.conf Normal file
View File

@ -0,0 +1,77 @@
####
# This file is the default configuration file for SquidAnalyzer
# Edit it to match your needs and copy it under /etc/squidanalyzer.conf
#####
# Path where SquidAnalyzer should dump all HTML and images files.
# Choose a path that can be read by a Web browser
Output /var/www/squidanalyzer
# The URL of the SquidAnalyzer javascript, HTML and images files.
WebUrl /squidreport
# Set the path to the Squid log file
LogFile /var/log/squid3/access.log
# Set the file containing network alias name. Network are
# show as Ip addresses so if you want to display name instead
# create a file with this format :
# LOCATION_NAME IP_NETWORK_ADDRESS
# Separator must be a tabulation
NetworkAlias /etc/squidanalyzer/network-aliases
# Set the file containing user alias name. If you don't have auth_proxy
# enable user are seen as Ip addresses, or if you want to replace login
# name by full user name, create a file with this format :
# FULL_USERNAME IP_ADDRESS || LOGIN_NAME
# Separator must be a tabulation
UserAlias /etc/squidanalyzer/user-aliases
# How do we sort Network, User and Url report screen
# Value can be: bytes, hits or duration. Default is bytes.
OrderNetwork bytes
OrderUser bytes
OrderUrl bytes
# How do we sort Mime types report screen
# Value can be: bytes or hits. Default is bytes.
OrderMime bytes
# Should we display user details. This will show all URL read
# by user. Take care to have enougth space disk for large user.
UrlReport 1
# Run in quiet mode or print debug information
QuietMode 1
# Cost of the bandwith per Mb. If you want to generate invoice per Mb
# for bandwith traffic this can help you. Value 0 mean no cost.
CostPrice 0.5
# Currency of the bandwith cost
Currency &euro;
# Top number of url to show
TopNumber 100
# Path to the file containing client ip addresses, network ip address,
# and/or auth login to exclude from report
Exclude /etc/squidanalyzer/excluded
# Language to use (currently only En and Fr are available)
#Lang /etc/squidanalyzer/lang/French.txt
# Date format use to display date (year = %y, month = %m and day = %d)
DateFormat %y-%m-%d
# Custom Footer. Must be a path to a text file containing HTML code that
# will be placed at the bottom of each page just before the end if the
# body tag. Default is defined internally if this directive is not set
# to a valid file.
#FooterFile /etc/squidanalyzer/lang/fr_FR_footer.txt
#Set this to 1 if you want to anonymize all user login. The username
# will be replaced by an unique id that change at each squid-analyzer
# run. Default disable.
AnonymizeLogin 0

16
squidanalyzer.css Normal file
View File

@ -0,0 +1,16 @@
body {font-family:arial,helvetica,verdana;font-size:10pt;background-color: beige;}
table {margin: 1px; align: center; width: 100%; white-space: nowrap}
td {font-family:arial,helvetica,verdana;font-size:10pt;color:black;background-color: beige;}
th {font-family:arial,helvetica,verdana;font-weight:bold;font-size:12pt;color:white; background-color: green;}
a { text-decoration: none; font-family:arial,helvetica,verdana;font-weight:bold;font-size:12pt;color: #888888}
a:hover { text-decoration: none; font-family:arial,helvetica,verdana;font-weight:bold;font-size:12pt;color: black}
#logo a {font-family:arial,helvetica,verdana;font-weight:bold;font-size:24pt;color:green;text-decoration: none;}
#calendar th {color: white; background-color: green;}
#calendar table {width: 200px; position: right;}
#menu table {position: right; width: auto;}
#menu th {background-color: beige;}
#stata table {position: center; width: auto;}
#stata td {border-bottom: thin solid red; text-align: center; width: 100px}
#statb table {position: center; width: auto;}
#statb td {border-bottom: thin solid red; text-align: center; width: 100px}
#uplink th {background-color: beige;}

7
user-aliases Normal file
View File

@ -0,0 +1,7 @@
#-------------------------------------------------------------------------------
# Squid Analyzer User Alias configuration file
# FORMAT : FULL_USER_NAME IP_ADDRESS|LOGIN_NAME,LOGIN_REGEX
# Field separator must be one or more tabulation. See example bellow
#-------------------------------------------------------------------------------
#MyFirstName mylogin,192.168.1.12
#MyOtherNames logon\d+