3 # yaala - Yet Another Advanced Log Analyser
4 # Copyright (C) 2000-2007 Florian octo Forster
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; only version 2 of the license is applicable.
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # You should have received a copy of the GNU General Public License along with
16 # this program; if not, write to the Free Software Foundation, Inc., 675 Mass
17 # Ave, Cambridge, MA 02139, USA.
21 if ($0 =~ m#^(.*)[/\\]#) { chdir ($1); }
23 unshift (@::INC, 'lib');
25 # 0x010: lib/Data/Core.pm
26 # 0x020: lib/Data/Setup.pm
27 # 0x040: lib/Data/Convert.pm
28 # 0x080: lib/Data/Core.pm (dump any data stored!)
29 # 0x100: lib/Report/GDGraph.pm
30 # 0x200: lib/Data/Persistent.pm
31 # 0x2000: lib/Yaala/Parser/WebserverTools.pm
48 use Yaala::Config qw#get_config parse_argv read_config#;
52 $HOMEPAGE = 'http://yaala.org/';
62 print STDERR $/, __FILE__, ': $Id: yaala,v 1.17 2004/11/10 10:07:43 octo Exp $' if ($DEBUG);
65 read_config (get_config ('config') ? get_config ('config') : 'config');
67 unless (get_config ('input'))
73 # report and data initialization needs parser module
74 my $logtype = get_config ('logtype');
75 my $report = get_config ('report' );
76 $logtype ||= 'Common';
77 $report ||= 'Combined';
78 $logtype = ucfirst (lc ($logtype));
79 $report = ucfirst (lc ($report ));
81 require "Yaala/Parser/$logtype.pm";
82 require "Yaala/Report/$report.pm";
83 import Yaala::Parser qw#parse extra#;
84 import Yaala::Report qw#generate#;
86 print STDERR $/, __FILE__, ": Accumulating data.." if ($DEBUG);
88 my $num_read_files = 0;
90 for (get_config ('input'))
93 if (open (LOGFILE, '< ' . $_))
95 print STDERR $/, __FILE__, qq#: Reading "$_"# if ($DEBUG);
98 parse ($_) while (<LOGFILE>);
104 print STDERR $/, __FILE__, qq#: Error opening "$_": $!#;
107 if (!$num_read_files)
109 print STDERR $/, __FILE__, ": Could not read any files. Exiting.\n";
115 print STDERR $/, __FILE__, ': Generating pages..' if ($DEBUG);
118 print STDERR $/, __FILE__, ": Exiting.." if ($DEBUG);
122 ##################################################
123 # end of main program #
124 #---=====================------------------------#
125 # surprised?? well, it's pretty short, cause all #
126 # the _real_ work is done in the the modules. #
127 # If you write a modul by your own: PLEASE send #
128 # me a copy so that i can include it in the #
130 # And how about 12 modules at a time ? -- qmax #
131 # Awesome :) -- octo #
132 ##################################################
138 Usage: $0 [--<key> <value>] file1 .. fileN
141 --config Specify alternate config file
142 --directory yaala will write all generated files to this
143 directory (and overwrite existing ones without
145 --report Selects the report type to use
146 --logtype Specifies the type of logfiles to parse
147 --select Select statements. See README.selections
149 You can prepend two dashes to every keyword in the config file and
150 configure yaala from the command line.
157 print STDERR $/ if ($DEBUG);