• PHP
  • Ruby on Rails
  • MySQL
  • Linux
    • SELINUX
    • Fedora
    • debian
  • Apache
  • nginx
  • AJAX
Albertech.net

Modifying awstats to show total hits for matching files

November 3, 2011 1:22 pm / Albertech.net

Here’s a quick modification to awstats that allows you to add a totals field for the “Viewed – Full List” option. There isn’t a total hits field for matching files in awstats, so I added one to make it more useful. This makes it a lot quicker to total up hits for a specific folder, file type, or specific file in awstats.

The information provided below is for informational purposes only.

1) Locate your awstats.pl file.
If you are using the awstats Debian/Ubuntu package, awstats is located in /usr/lib/cgi-bin/awstats.pl.

2) Backup the awstats.pl file.
cp awstats.pl awstats.pl.bak

3) Open up the awstats.pl file in your favorite text editor. Find line 8468 (approximately, depending on your version of awstats).

There should be the following code:
&tab_end();
&html_end(1);
}
if ($HTMLOutput{'unknownos'}) {

4) Above the &tab_end(); add the following lines:
# Total up the matching pages
print "<tr><td style=\"text-align: left\"><strong>Total</strong></td><td><strong>$total_p</strong></td></tr>\n";

The end result should look like:
# Total up the matching pages
print "<tr><td style=\"text-align: left\"><strong>Total</strong></td><td><strong>$total_p</strong></td></tr>\n";
&tab_end();
&html_end(1);
}
if ($HTMLOutput{'unknownos'}) {

5) Save the awstats.pl file. Any future updates to Awstats package will overwrite these changes, but the fix should only take a minute to add it back in. If it doesn’t work, copy the awstats.pl.bak file as awstats.pl.

The modification will add the totals row for the following awstats reports:

Share this:

  • Facebook
  • Google
  • Twitter
  • Print
  • Email
Posted in: Apache / Tagged: awstats, code, mods

One Thought on “Modifying awstats to show total hits for matching files”

  1. Pingback: Al

Post Navigation

← Previous Post
Next Post →

Categories

  • AJAX
  • Android
  • Apache
  • Canon Cameras
  • Cloud
  • CMS
  • Computer Mods
  • Conferences
  • Deals
  • debian
  • Fedora
  • Flash
  • Frameworks
  • git
  • Hardware
  • HTML
  • IDE
  • iPhone
  • iPhone App Review
  • jQuery
  • Linux
  • Mac OS X
  • MySQL
  • nginx
  • PHP
  • portfolio
  • Puppet
  • Ruby on Rails
  • Script Reviews
  • SELINUX
  • Software
  • Software Review
  • SQL Server
  • statistics
  • Tech
  • Tomcat
  • Uncategorized
  • VMWARE
  • VPS
  • Windows
  • wordpress
  • Zend Framework

Blogroll

  • DragonAl Flickr
  • Dropbox – Free 2GB Account
  • James' Blog
  • Javascript Compressor
  • PHP Builder Community
  • PHP-Princess.net
  • Rubular – Regular Expression Validator
  • The Scale-Out Blog
  • Tiny MCE

Tags

activation AJAX android antec Apache AWS awstats canon coda codeigniter debian enclosure external free G1 install vmware tools Internet Explorer iphone 5 jquery Linux mx-1 MySQL office 2007 OSX photoshop PHP plugin plugins portfolio redesigned website review rewrite script security SELinux ssh tinymce tutorial upgrade VMWARE vmware server wordpress wordpress mu XSS zend framework
© Copyright 2013 Albertech.net
Infinity Theme by DesignCoral / WordPress
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.