"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "squid-analyzer" between
squidanalyzer-6.5.tar.gz and squidanalyzer-6.6.tar.gz

About: SquidAnalyzer is a Squid (proxy) log analyzer.

squid-analyzer  (squidanalyzer-6.5):squid-analyzer  (squidanalyzer-6.6)
skipping to change at line 31 skipping to change at line 31
my $debug = 0; my $debug = 0;
my $version = 0; my $version = 0;
my $build_date = ''; my $build_date = '';
my $pid_dir = '/tmp'; my $pid_dir = '/tmp';
my $pidfile = 'squid-analyzer.pid'; my $pidfile = 'squid-analyzer.pid';
my $queue_size = 0; my $queue_size = 0;
my $timezone = ''; my $timezone = '';
my $no_year_stat = 0; my $no_year_stat = 0;
my $no_week_stat = 0; my $no_week_stat = 0;
my $t0 = Benchmark->new; my $t0 = Benchmark->new;
my $start_time = '';
my $stop_time = '';
# get the command line parameters # get the command line parameters
my $result = GetOptions ( my $result = GetOptions (
"c|configfile=s" => \$configfile, "c|configfile=s" => \$configfile,
"b|build_date=s" => \$build_date, "b|build_date=s" => \$build_date,
"d|debug!" => \$debug, "d|debug!" => \$debug,
"h|help" => \$help, "h|help" => \$help,
"j|jobs=i" => \$queue_size, "j|jobs=i" => \$queue_size,
"l|logfile" => \$obsolete, "l|logfile" => \$obsolete,
"p|preserve=i" => \$preserve, "p|preserve=i" => \$preserve,
"P|pid_dir=s" => \$pid_dir, "P|pid_dir=s" => \$pid_dir,
"r|rebuild!" => \$rebuild, "r|rebuild!" => \$rebuild,
"s|start=s" => \$start_time,
"S|stop=s" => \$stop_time,
"t|timezone=s" => \$timezone, "t|timezone=s" => \$timezone,
"v|version!" => \$version, "v|version!" => \$version,
"no-year-stat!" => \$no_year_stat, "no-year-stat!" => \$no_year_stat,
"no-week-stat!" => \$no_week_stat, "no-week-stat!" => \$no_week_stat,
); );
# Show warning for obsolete options # Show warning for obsolete options
if ($obsolete) { if ($obsolete) {
print STDERR "WARNING: use of obsolete -l option, log files must be given at command line arguments.\n" print STDERR "WARNING: use of obsolete -l option, log files must be given at command line arguments.\n"
} }
skipping to change at line 68 skipping to change at line 72
} }
if ($build_date) { if ($build_date) {
$rebuild = 1; $rebuild = 1;
if ( ($build_date !~ /^\d{4}-\d{2}-\d{2}$/) && ($build_date !~ /^\d{4}-\d {2}$/) && ($build_date !~ /^\d{4}$/) ) { if ( ($build_date !~ /^\d{4}-\d{2}-\d{2}$/) && ($build_date !~ /^\d{4}-\d {2}$/) && ($build_date !~ /^\d{4}$/) ) {
die("FATAL: bad syntax for build_date, expecting format: yyyy-mm- dd, yyyy-mm or yyyy\n"); die("FATAL: bad syntax for build_date, expecting format: yyyy-mm- dd, yyyy-mm or yyyy\n");
exit 0; exit 0;
} }
} }
if ($start_time && $start_time !~ /^[0-2]\d:[0-5]\d$/) {
die("FATAL: bad format on start time, must be HH:MM.\n");
}
if ($stop_time && $stop_time !~ /^[0-2]\d:[0-5]\d$/) {
die("FATAL: bad format on stop time, must be HH:MM.\n");
}
# Add multiple log files given from command line # Add multiple log files given from command line
foreach my $f (@ARGV) { foreach my $f (@ARGV) {
push(@logfile, $f) if (-f $f && !-z $f); push(@logfile, $f) if (-f $f && !-z $f);
} }
# Set default configuration file # Set default configuration file
$configfile ||= $DEFAULT_CONFFILE; $configfile ||= $DEFAULT_CONFFILE;
if ($help) { if ($help) {
&usage; &usage;
skipping to change at line 99 skipping to change at line 110
close(OUT); close(OUT);
# Clear multiprocess temporary file if any # Clear multiprocess temporary file if any
unlink("$pid_dir/last_parsed.tmp"); unlink("$pid_dir/last_parsed.tmp");
# Instanciate SquidAnalyzer.pm perl module # Instanciate SquidAnalyzer.pm perl module
my $sa = new SquidAnalyzer($configfile, join(',', @logfile), $debug, $rebuild, $ pid_dir, $pidfile, $timezone); my $sa = new SquidAnalyzer($configfile, join(',', @logfile), $debug, $rebuild, $ pid_dir, $pidfile, $timezone);
$sa->{no_year_stat} = $no_year_stat; $sa->{no_year_stat} = $no_year_stat;
$sa->{no_week_stat} = $no_week_stat; $sa->{no_week_stat} = $no_week_stat;
$sa->{queue_size} = $queue_size; $sa->{queue_size} = $queue_size;
$sa->{TimeStart} = $start_time;
$sa->{TimeStop} = $stop_time;
# Die cleanly on signal # Die cleanly on signal
sub terminate sub terminate
{ {
# block signal # block signal
local $SIG{TERM} = 'IGNORE'; local $SIG{TERM} = 'IGNORE';
local $SIG{INT} = 'IGNORE'; local $SIG{INT} = 'IGNORE';
print("LOG: Received terminating signal.\n"); print("LOG: Received terminating signal.\n");
skipping to change at line 139 skipping to change at line 152
exit 0; exit 0;
} }
# Handle signals to die cleanly # Handle signals to die cleanly
$SIG{'INT'} = \&terminate; $SIG{'INT'} = \&terminate;
$SIG{'TERM'} = \&terminate; $SIG{'TERM'} = \&terminate;
$SIG{'CHLD'} = 'DEFAULT'; $SIG{'CHLD'} = 'DEFAULT';
my $t1; my $t1;
# Run parsing only if we have a log file or that we are not in rebuild mode # Run parsing only if we have a log file or that we are not in rebuild mode
if (!$rebuild || ($#logfile >= 0)) { if (!$rebuild || ($#{$sa->{LogFile}} >= 0)) {
$sa->parseFile(); $sa->parseFile();
if ($debug) { if ($debug) {
$t1 = Benchmark->new; $t1 = Benchmark->new;
my $td = timediff($t1, $t0); my $td = timediff($t1, $t0);
print STDERR "DEBUG: the log statistics gathering took:", timestr ($td), "\n"; print STDERR "DEBUG: the log statistics gathering took:", timestr ($td), "\n";
} }
} }
# Remove old statistics # Remove old statistics
if ($preserve) { if ($preserve) {
skipping to change at line 187 skipping to change at line 200
sub usage sub usage
{ {
print qq{ print qq{
Usage: squid-analyzer [ -c squidanalyzer.conf ] [logfile(s)] Usage: squid-analyzer [ -c squidanalyzer.conf ] [logfile(s)]
-c | --configfile filename : path to the SquidAnalyzer configuration file. -c | --configfile filename : path to the SquidAnalyzer configuration file.
By default: $DEFAULT_CONFFILE By default: $DEFAULT_CONFFILE
-b | --build_date date : set the date to be rebuilt, format: yyyy-mm-dd -b | --build_date date : set the date to be rebuilt, format: yyyy-mm-dd
or yyyy-mm or yyyy. Used with -r or --rebuild. or yyyy-mm or yyyy. Used with -r or --rebuild.
-d | --debug : show debug informations. -d | --debug : show debug information.
-h | --help : show this message and exit. -h | --help : show this message and exit.
-j | --jobs number : number of jobs to run at same time. Default is -j | --jobs number : number of jobs to run at same time. Default
1, is 1, run as single process.
run as single process.
-p | --preserve number : used to set the statistic obsolescence in -p | --preserve number : used to set the statistic obsolescence in
number of month. Older stats will be removed. number of month. Older stats will be removed.
-P | --pid_dir directory : set directory where pid file will be stored. -P | --pid_dir directory : set directory where pid file will be stored.
Default /tmp/ Default /tmp/
-r | --rebuild : use this option to rebuild all html and graphs -r | --rebuild : use this option to rebuild all html and graphs
output from all data files. output from all data files.
-t, --timezone +/-HH : set number of hours from GMT of the timezone. -s | --start HH:MM : log lines before this time will not be parsed.
-S | --stop HH:MM : log lines after this time will not be parsed.
-t | --timezone +/-HH : set number of hours from GMT of the timezone.
Use this to adjust date/time of SquidAnalyzer Use this to adjust date/time of SquidAnalyzer
output when it is run on a different timezone output when it is run on a different timezone
than the squid server. than the squid server.
-v | version : show version and exit. -v | version : show version and exit.
--no-year-stat : disable years statistics, reports will start --no-year-stat : disable years statistics, reports will start
from month level only. from month level only.
--no-week-stat : disable weekly statistics. --no-week-stat : disable weekly statistics.
Log files to parse can be given as command line arguments or as a comma separate d Log files to parse can be given as command line arguments or as a comma separate d
list of file for the LogFile configuration directive. By default SquidAnalyer wi ll list of file for the LogFile configuration directive. By default SquidAnalyer wi ll
 End of changes. 8 change blocks. 
6 lines changed or deleted 20 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS