anyone else using webalizer?
- From: joe <jcharth@xxxxxxxxx>
- Date: Thu, 13 Dec 2007 09:39:18 -0800 (PST)
Hello everyone I wrote a little script in perl to dig the stats out of
the usage.html files. Looks like webalizer preservers old files, so
log rotation can be achieved by fliping the log on the first of the
months. Here is a script that uses the sorttable.js script from
kryogenix.org. It must be in the same folder as the usage.html files
and therefore exec must be enable.
#!/usr/bin/perl -w
use HTML::TokeParser;
print <<EOF;
Content-Type: text/html
<HTML>
<HEAD>
<script src="sorttable.js"></script>
<TITLE>Usage Statistics</TITLE>
</HEAD>
<BODY BGCOLOR="#E8E8E8" TEXT="#000000" LINK="#0000FF"
VLINK="#FF0000"><center>
<TABLE class="sortable">
<thead>
<tr>
<th>Date</th>
<th>T Hits</th>
<th>T Files</th>
<th>T Pages</th>
<th>T Visits</th>
<th>T KBytes</th>
<th>U Sites</th>
<th>U URLs</th>
<th>U Referrers</th>
<th>U Usernames</th>
<th>U User Agents</th>
</tr>
</thead>
<tbody>
EOF
$startofline = "<TR><TD>";
$separator = "<\/TD><TD>";
$endofline = "<\/TD><\/TR>\n";
opendir(DIR, ".");
my @files = sort(grep(/^usage_/,readdir(DIR)));
closedir(DIR);
sort(@files);
foreach $file (@files) {
$name = $file;
$name =~ s/\.html//g;
$name =~ s/usage\_//g;
print "$startofline<A HREF=\"$file\">$name<\/A>$separator";
$p = HTML::TokeParser->new(shift||"$file");
$i = 0;
while (my $token = $p->get_tag("b")) {
$i++;
if ($i > 10){ last;}
my $text = $p->get_trimmed_text("/b");
if (($i > 0) and ($i < 10)){ print "$text$separator";}
if ($i eq 10){ print "$text$endofline";}
} #end of while token
}
print "</tbody><\/TABLE>";
print "<\/CENTER><\/BODY><\/HTML>";
.
- Prev by Date: Robert Half International Houston TX - Linux/Unix Systems Administrator Job
- Next by Date: Re: Robert Half International Houston TX - Linux/Unix Systems Administrator Job
- Previous by thread: Robert Half International Houston TX - Linux/Unix Systems Administrator Job
- Next by thread: mail format
- Index(es):
Relevant Pages
|
|