#!/usr/bin/perl # yaala - Yet Another Advanced Log Analyser # Copyright (C) 2000-2007 Florian octo Forster # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; only version 2 of the license is applicable. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 675 Mass # Ave, Cambridge, MA 02139, USA. BEGIN { if ($0 =~ m#^(.*)[/\\]#) { chdir ($1); } unshift (@::INC, 'lib'); # 0x010: lib/Data/Core.pm # 0x020: lib/Data/Setup.pm # 0x040: lib/Data/Convert.pm # 0x080: lib/Data/Core.pm (dump any data stored!) # 0x100: lib/Report/GDGraph.pm # 0x200: lib/Data/Persistent.pm # 0x2000: lib/Yaala/Parser/WebserverTools.pm $::DEBUG = 0x0000; } use strict; use warnings; use vars qw( $DEBUG $EXTRA $NAME $VERSION $HOMEPAGE ); use Carp; use Yaala::Config qw#get_config parse_argv read_config#; $NAME = 'yaala'; $VERSION = '0.7.3'; $HOMEPAGE = 'http://yaala.org/'; if ($DEBUG) { select STDOUT; $| = 1; } $EXTRA = {}; print STDERR $/, __FILE__, ': $Id: yaala,v 1.17 2004/11/10 10:07:43 octo Exp $' if ($DEBUG); parse_argv (@ARGV); read_config (get_config ('config') ? get_config ('config') : 'config'); unless (get_config ('input')) { usage (); exit (1); } # report and data initialization needs parser module my $logtype = get_config ('logtype'); my $report = get_config ('report' ); $logtype ||= 'Common'; $report ||= 'Combined'; $logtype = ucfirst (lc ($logtype)); $report = ucfirst (lc ($report )); require "Yaala/Parser/$logtype.pm"; require "Yaala/Report/$report.pm"; import Yaala::Parser qw#parse extra#; import Yaala::Report qw#generate#; print STDERR $/, __FILE__, ": Accumulating data.." if ($DEBUG); my $num_read_files = 0; for (get_config ('input')) { #no strict 'refs'; if (open (LOGFILE, '< ' . $_)) { print STDERR $/, __FILE__, qq#: Reading "$_"# if ($DEBUG); $num_read_files++; parse ($_) while (); close LOGFILE; } else { print STDERR $/, __FILE__, qq#: Error opening "$_": $!#; } } if (!$num_read_files) { print STDERR $/, __FILE__, ": Could not read any files. Exiting.\n"; exit (1); } extra (); print STDERR $/, __FILE__, ': Generating pages..' if ($DEBUG); generate (); print STDERR $/, __FILE__, ": Exiting.." if ($DEBUG); exit (0); ################################################## # end of main program # #---=====================------------------------# # surprised?? well, it's pretty short, cause all # # the _real_ work is done in the the modules. # # If you write a modul by your own: PLEASE send # # me a copy so that i can include it in the # # package. # # And how about 12 modules at a time ? -- qmax # # Awesome :) -- octo # ################################################## sub usage { print STDOUT < ] file1 .. fileN Options: --config Specify alternate config file --directory yaala will write all generated files to this directory (and overwrite existing ones without prompting!) --report Selects the report type to use --logtype Specifies the type of logfiles to parse --select Select statements. See README.selections You can prepend two dashes to every keyword in the config file and configure yaala from the command line. EOF return (1); } END { print STDERR $/ if ($DEBUG); }