I see a lot of people asks for crossed reports (I don't ask but me too need
them): maybe this perl program can be useful.

How it works: it makes a BIG array with your logs (be careful if you have
huge logs!) and grep this array for a particular string (called $myquery).
The result is saved as $fileout and can be ANALOGged or grepped again for
multiple keys (e.g. to find all queries from AltaVista containing a
particular word).

Setting $myquery ="01/Jan/2000:13:" you can find 01/01/2000 requests
between 13.00 and 13.59.

Setting $myquery ="/banners/thatbanner.jpg" you can see how many
"exposures" has that banner.

Setting $myquery ="http://www.altavista.com/cgi-bin/query?" you can see
requests coming from AltaVista.

Adapt $myquery to you log format as you need.

After you run this program you must set LOGFILE as $fileout (in this sample
is "grepped.log") into your Analog config file, and you have a report just
related to $myquery.

This program isn't a masterwork of optimization, but it's newbie-proof.
I scan a 14.5 Mb group of logs (9,000 results on 91,000 lines) in 9 secs.

Remember however to backup your logs, and move away $fileout from log
directory when you run Analog on general logs, or you find double hits.

Hope this helps somebody, especially Stephen to answer strange questions :-)

Who need more infos mail me privately; who reply on the list PLEASE DON'T
QUOTE ALL THIS MESSAGE!

Bye!

Marco Bernardini


############## perl code starts here ##############

#/usr/bin/perl -w 
# arrange your perl path!

use strict;

# insert between "" the searched word

my $myquery = "/banners/thatbanner.jpg";

###################################################

# set here your configuration

my $dir ="/logs"; # directory containing your logs
my $fileout = "grepped.log" ; # output file - path RELATIVE to $dir

###################################################

my $adesso = time ;
my $logfile = "" ;
my @grandelog = "" ;
my $linea = "" ;
my @risultato = "" ;

opendir DIR, $dir or die "Error opening directory $dir: $!\n";

my @files=grep !/^\./, readdir(DIR);

chdir $dir;

foreach $logfile (@files) {

open (PAGE ,"<$logfile") || die $!;
push ( @grandelog , <PAGE>);
close PAGE;
}
chomp @grandelog;

@risultato = grep (/$myquery/,@grandelog);

open (PAGE ,">$fileout") || die $!;
foreach $linea (@risultato) {
    print PAGE "$linea\n";
}
close PAGE;

my $dopo=time;
my $tempo=$dopo-$adesso;

print "Job time: $tempo seconds\n";
print "Find " , scalar(@risultato) , " lines containing $myquery on " ,
scalar(@grandelog) , " checked\n";
print "The result was saved as $fileout into $dir directory\n";

############## perl code ends here ##############

------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------

Reply via email to