奇科電腦 回奇科電腦首頁奇科電腦LPI課程資訊奇科電腦Embedded課程資訊奇科電腦Cisco課程資訊奇科電腦Programming課程資訊奇科電腦Smartphone App課程資訊
Tech Tips2  How to estimate the frequency of web page surfing per hour every day from Apache?

Author: Ben|Date: 2007/05/31|Back to Tech Tips

To estimate the frequency of web page surfing per hour every day from Apache access_log, a simple Perl programming is shown as follows:

#!/usr/bin/perl -w

open ( FH, "../../access_log.1" );
while ( )
{
chomp;
$_ =~ s/^.*?:(\d{2}):.*/$1/;
$hr{$_}++;
}
close( FH );
foreach ( sort keys %hr )
{
print "Hour $_ has $hr{$_} times access.\n";
}
--


Best Browse: 1024x768 Copyright 2010 GeeGo Systems, Ltd.
service@geego.com.tw|DL: 0800-296-296|3F., No.60, Zhulun St., Zhongshan Dist., Taipei City 104, Taiwan (R.O.C.)|02-2711-6373