in reply to Obtaining Apache logfile stats?
i wasnt able to get apache::parselog to work
From this comment and your data sample, I have to guess that you aren't using a standard log format, right? Can you show us a sample of your log data and/or the CustomLog directive you use in your Apache configuration? Without that, we can't help you slice and dice it in Perl.
is there a simple way with perl to parse the file and have the ability to pass a file name as an argument?
Yes. Something like the following might work well enough for you depending, of course, on what you haven't told us yet...
Put that in a file and run it with two arguments, the full pathname of the file you want stats on and the pathname of the file your parsed log data (i.e. the sample you provided) is in. Something like:#!perl -lan BEGIN { $SUM = $N = 0; $file = shift; } if ($F[1] eq $file) { my ($secs) = ($F[2] =~ /^(\d+)/); $SUM += $secs; $N++ } END { print "Average: " , $SUM/ $N; }
perl get_stats /manual/misc/perf-tuning.html log.data
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Obtaining Apache logfile stats?
by mvam (Acolyte) on Mar 25, 2004 at 21:46 UTC | |
by sauoq (Abbot) on Mar 25, 2004 at 22:28 UTC | |
by mvam (Acolyte) on Mar 25, 2004 at 23:14 UTC | |
by sauoq (Abbot) on Mar 26, 2004 at 00:41 UTC | |
by mvam (Acolyte) on Mar 26, 2004 at 16:54 UTC | |
| |
by sauoq (Abbot) on Mar 25, 2004 at 21:56 UTC | |
by DamnDirtyApe (Curate) on Mar 25, 2004 at 22:05 UTC | |
by mvam (Acolyte) on Mar 25, 2004 at 22:01 UTC |