summaryrefslogtreecommitdiff
path: root/scripts/apache-log-analyse.pl
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-10-20 18:30:38 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-10-20 18:30:38 +0200
commita912627e092ada9ac29bd762bc10254bf00618f9 (patch)
tree33c2cabe0a811687127171962552b0aecdbe95cb /scripts/apache-log-analyse.pl
parent1310af65251fce6c422155f14add06cb6b4521bd (diff)
some more detail in the by_date table
Diffstat (limited to 'scripts/apache-log-analyse.pl')
-rwxr-xr-xscripts/apache-log-analyse.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/apache-log-analyse.pl b/scripts/apache-log-analyse.pl
index 0de9f8f0..6bb6bd89 100755
--- a/scripts/apache-log-analyse.pl
+++ b/scripts/apache-log-analyse.pl
@@ -4,6 +4,9 @@ use Date::Parse;
use Date::Format;
my %bydate; # date -> page -> count
+my %bydate_direct;
+my %bydate_wiki;
+my %bydate_google;
my %referrers; # count of referrers by URL
my @month_names = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
@@ -79,7 +82,13 @@ while (<>) {
$monthkey = "$year-$month-01";
# print "Date '$date' -> '$monthkey'\n";
$bydate{$monthkey} = 0 if (!defined $bydate{$monthkey});
+ $bydate_direct{$monthkey} = 0 if (!defined $bydate_direct{$monthkey});
+ $bydate_wiki{$monthkey} = 0 if (!defined $bydate_wiki{$monthkey});
+ $bydate_google{$monthkey} = 0 if (!defined $bydate_google{$monthkey});
$bydate{$monthkey} += 1;
+ $bydate_direct{$monthkey} += 1 if ($referrer eq '');
+ $bydate_wiki{$monthkey} += 1 if ($referrer =~ 'wiki.documentfoundation');
+ $bydate_google{$monthkey} += 1 if ($referrer =~ 'google');
}
print << 'EOF'
@@ -145,6 +154,18 @@ print << 'EOF'
<table:table-cell table:style-name="boldheader" office:value-type="string">
<text:p>Hits</text:p>
</table:table-cell>
+ <table:table-cell table:style-name="boldheader" office:value-type="string">
+ <text:p>Direct</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="boldheader" office:value-type="string">
+ <text:p>Direct</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="boldheader" office:value-type="string">
+ <text:p>Wiki</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="boldheader" office:value-type="string">
+ <text:p>Google</text:p>
+ </table:table-cell>
</table:table-row>
EOF
;
@@ -154,6 +175,9 @@ print << "EOF"
<table:table-cell table:style-name="isodate" office:value-type="date"
office:date-value="$date"/>
<table:table-cell office:value-type="float" office:value="$bydate{$date}"/>
+ <table:table-cell office:value-type="float" office:value="$bydate_direct{$date}"/>
+ <table:table-cell office:value-type="float" office:value="$bydate_wiki{$date}"/>
+ <table:table-cell office:value-type="float" office:value="$bydate_google{$date}"/>
</table:table-row>
EOF
;