Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


March 2005

Analyzing Web Statistics with AWStats

This exceptionally robust package runs on Windows
RSS
Subscribe to Windows IT Pro | See More Internet Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

Step 6. Build the Reports
After you define your IIS Web site, it's time to get to the fun stuff—building the reports. Change to the C:\Program Files\AWStats\tools directory and execute the command

awstats_
  buildstaticpages.pl
-config=WebSiteName
-update -lang=en
-dir="C:\Inetpub\awstats"
-awstatsprog=
  "C:/Program Files/
  AWStats/wwwroot/
  cgi bin/awstats.pl"

where WebSiteName is your Web site's name (e.g., www.toombspartners.com for the Toombs Partners example). The report-generation component (i.e., awstats_buildstaticpages.pl) builds the main statistics report page, along with all related subpages, for your site and writes them to the directory specified by the -dir switch.

If everything is working properly, AWStats should create one report after another, until the processing cycle is complete. After the reporting cycle finishes, you can open a Web browser on your system and navigate to your newly created AWStats Web site. The main page of the AWStats report should be your default page. Figure 5 shows a portion of a sample main output page.

The main output page contains a number of high-level statistics and clickable links that let you drill-down into more detail. For example, if you click the Countries link under the Who section in Figure 5, you'll be sent to the Countries (Top 10) table that's further down in the main output page. Clicking the Full list link in the table's title bar takes you to a table that lists all the visitors' countries. Alternatively, you can go directly to the full list of countries by clicking the Full list link that appears after the Countries link in the Who section.

But wait—you don't have country statistics in your report? Not to worry, this is the default behavior for AWStats. Let's look at how to fix that.

One of the primary mechanisms used to determine where a visitor is coming from is to perform a reverse lookup on the visitor's IP address to see whether there's a Fully Qualified Domain Name (FQDN) associated with that address. If there's a proper FQDN associated with the IP address, the address should end in an extension such as .com, .ca, or .jp. AWStats uses this extension to determine where the visitor is coming from.

In its default configuration, AWStats doesn't perform reverse DNS lookups because it takes a significant amount of time to perform a reverse DNS lookup for every IP address that comes to a site. AWStats is highly efficient in its own processing, but when it must submit a query to an external DNS server and wait for the response, the process literally slows down exponentially. For example, the three test log files that I'm using for this article contain about 350,000 addresses. Without performing reverse DNS lookups, AWStats analyzed this much data in only a few minutes. With reverse lookups enabled, the process took more than 6 hours to complete. So, there's a significant performance hit involved with performing reverse DNS lookups.

If you want AWStats to perform reverse DNS lookups, you need to find the DNSLookup parameter in your site's configuration file and change the parameter's value from 2 to 1. After you set that parameter value, AWStats will attempt to perform a reverse DNS lookup for every IP address in any new log files you analyze. In other words, you need to manually reanalyze any existing log files. To do so, delete the AWStats database file for your site, then start the analysis process again. This time, AWStats will perform a reverse DNS lookup for all your records—but be prepared for it to take a long time. After AWStats has analyzed your log files with reverse lookups, simply create the reports again and you should have the statistics about which countries your visitors are from.

Step 7. Schedule AWStats to Run Nightly
You'll probably want to have AWStats process your log files every night so that you don't have to manually execute the analysis and report-generation applications. To do this, you can use the NightRun.bat file, which Listing 1 shows. This batch file first calls the analysis application, which analyzes the IIS log files. After the analysis process completes, the batch file then calls the report-generation application, which creates the reports and places them in the IIS directory for AWStats.

To use NightRun.bat, first download the file from the Windows IT Pro Web site. Go to http://www.windowsitpro.com, enter 45264 in the InstantDoc ID text box, then click the 45264.zip hotlink. Next, open the file in Notepad or another text editor, and replace each occurrence of www.toombspartners.com with your Web site's name. Finally, open the Control Panel Scheduled Tasks applet and schedule the batch file to run every night at some point after midnight. Why after midnight? When I showed you how to execute AWStats in Step 4, I used the -logfile switch to supply a specific log-file name. If that switch is missing, as it is in NightRun.bat, AWStats automatically chooses the previous day as the date to use for any wildcards defined in the configuration file's Logfile= parameter. So, if this batch file executes after midnight on June 4, AWStats analyzes the log files for June 3 because a wildcard date format was used in the LogFile parameter's value.

Web Statistics That Are Just a Click Away
It's nice to have a fresh set of Web statistics ready and waiting for you every morning. If you're not mining your company's Web site data, you should be, even if you aren't selling products on your site. The statistics can give you a better idea as to what people are looking for when they find your Web site—and in today's age of customer service, that's always a good thing to know.

Project Snapshot: How to
PROBLEM: If your company is put off by the high cost of Web analysis software, you can use AWStats.
WHAT YOU NEED: AWStats, ActivePerl, and NightRun.bat
DIFFICULTY: 3.5 out of 5
PROJECT STEPS:
  1. Customize IIS.
  2. Install ActivePerl and AWStats.
  3. Configure AWStats.
  4. Run AWStats.
  5. Create a Web server for AWStats.
  6. Build the reports.
  7. Schedule AWStats to run nightly.



End of Article

   Previous  1  2  [3]  Next  


Reader Comments
Great tutorial. Thanks! AWStats gives a wealth of info. This article alone is worth the price of my subscription.

stylistic500 March 31, 2005 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Learning Path To learn more about AWStats:
"http://awstats.sourceforge.net"


Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


IIS and Web Administration Whitepapers Best Practices for SharePoint Backup & Recovery

Meeting Compliance Objectives in SharePoint

Improve SharePoint Performance for Remote Workers

Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Managing IT Across Multiple Locations

The Easiest Way to Save Time and Money on E-mail and SharePoint Management

Check out our list of Free Email Newsletters!

IIS and Web Administration eBooks Web Filtering: An Assessment

Understanding and Leveraging Code Signing Technologies

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement