Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Obtaining Apache logfile stats?

by Not_a_Number (Prior)
on Mar 25, 2004 at 18:29 UTC ( [id://339906]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Obtaining Apache logfile stats?

use strict; use warnings; my %HoA; while ( <DATA> ) { next unless (split '/')[-1] =~ /(.*)\s+(\d+)_seconds?$/; $HoA{$1}[0] += $2; # Total seconds per 'user' $HoA{$1}[1] ++; # Total times accessed per 'user' } # Print average access time for a given 'user': my $user = 'mod_rewrite.html'; print "Unknown user: $user" and exit unless $HoA{$user}; print "User: $user\n"; print "Total seconds: $HoA{$user}[0]\n"; print "Total accesses: $HoA{$user}[1]\n"; print "Av. access time: ", $HoA{$user}[0] / $HoA{$user}[1]; print "\n\n"; # Print the whole HoA: print "$_: @{ $HoA{$_} }\n" for keys %HoA; __DATA__ [24/Mar/2004:12:26:52 /manual/misc/perf-tuning.html 0_seconds [24/Mar/2004:12:27:33 /manual/mod/mod_status.html 0_seconds [24/Mar/2004:12:27:33 /manual/mod/mod_status.html 33_seconds [24/Mar/2004:12:27:39 /manual/mod/module-dict.html 0_seconds [24/Mar/2004:12:27:46 /manual/misc/rewriteguide.html 0_seconds [24/Mar/2004:12:27:53 /manual/mod/mod_rewrite.html 5_seconds [24/Mar/2004:12:27:53 /manual/images/mod_rewrite_fig1.gif 0_seconds rabbit!!! [24/Mar/2004:12:27:53 /manual/images/mod_rewrite_fig2.gif 0_seconds [24/Mar/2004:12:28:05 /manual/new_features_1_3.html 0_seconds [24/Mar/2004:12:29:53 /manual/mod/mod_rewrite.html 6_seconds [24/Mar/2004:12:29:54 /manual/mod/mod_rewrite.html 7_seconds [24/Mar/2004:12:29:55 /manual/mod/mod_rewrite.html 8_seconds [24/Mar/2004:12:29:56 /manual/mod/mod_rewrite.html 9_seconds

dave

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://339906]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.