Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  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

Finally, the configuration application informs you that it can't automatically create scheduled tasks for you because you're installing AWStats on a Windows server. We'll take care of that task in Step 7, so for now just acknowledge the message, and the configuration program will be complete. The configuration parameters configured throughout this process are stored in C:\Program Files\AWStats\wwwroot\cgi-bin\awstats.www.toombspartners.com.conf.

There are still a few more settings you need to change, so open your configuration file with Notepad or another text editor. The first parameter you need to change is the path to your log files. By default, AWStats uses the path /var/log/httpd/mylog.log, which is a UNIX-centric file path, so it contains forward slashes (/) rather than backslashes (\). Look for the LogFile parameter in the configuration file, which will look like

LogFile="/var/log/httpd/mylog.log"

Replace "/var/log/httpd/mylog.log" with the default installation location for your log files. If you've followed a default installation of IIS, specify "C:/WINNT/System32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log". This value will instruct AWStats to look in the C:\WINNT\System32\LogFiles\W3SVC1 directory for filenames that begin with ex, end with .log, and have a two-digit year, two-digit month, and two-digit day in the middle. This is the default naming convention for IIS log files. If you're using another naming convention or if the log files are stored in a directory other than W3SVC1, adjust the LogFile parameter value accordingly.

Another parameter you need to change is the LogFormat parameter, which tells AWStats the type of logging. LogFormat is set to 1 by default. The proper value for an IIS Web site is 2.

You must also change the SiteDomain and HostAliases parameters, which define how the outside world references your Web site and how the Web site might be referenced internally, respectively. Change the SiteDomain parameter's value to the main domain name for your server or the main intranet site name. Modify the HostAliases parameter's value so that it specifies other possible domain names, addresses, or virtual host names that might also be used to reference your site internally.

Save the configuration file, then exit the text editor. You're now ready to run AWStats for the first time.

Step 4. Run AWStats
Assuming you configured everything correctly, you're ready to give AWStats its first run-through. However, to do so, you need to understand how AWStats works.

There are two primary components you'll be using in AWStats: the analysis application and the report-generation application. The analysis application does all the raw number crunching. The report-generation application converts the analyzed data into human-readable HTML reports.

Given the sheer volume of log information created by many Web sites, AWStats writes all its statistical-analysis results to its own database file. That way, when you execute AWStats again, it won't need to reanalyze the same data. Imagine how long AWStats would take to execute if you launched it in December and it had to go back and process the previous 11 months worth of log files every time.

To create the AWStats database and import an IIS log file into the analysis application, change to the C:\ProgramFiles\AWStats\wwwroot\cgi-bin directory and execute the command

awstats.pl -config=WebSiteName
  -update -logfile=IISLogName

where WebSiteName is your Web site's name and IISLogName is the name of the IIS log file you want to import into the database for analysis. (Although this command appears on several lines here, you would enter it on one line in the command window. The same holds true for the other multiline commands in this article.)

For example, suppose we want to analyze the IIS log files for the Toombs Partners Web site, starting with the month of June. It's June 4, so we have three complete IIS log files (i.e., the log files for June 1, June 2, and June 3) and one incomplete log file (i.e., the log file for June 4). To import the June 1 log file, run the command

awstats.pl 
-config=www.toombspartners.com
-update 
-logfile="C:/WINNT/system32/
logfiles/w3svc1/ex050601.log"

After running that command, we'd then process the ex050602.log and ex050603.log files in the same way.

AWStats uses the Web site's name in the database file's name. For example, in the case of Toombs Partners, the name of the database file is awstats%MM%YYYY.www.toombspartners.com.txt, where %MM is the two-digit month and %YYYY is the four-digit year.

When the analysis application starts analyzing log files, you should see the program display several statistics about what it's processing. When it finishes, you should see a statistic that specifies how many new qualified records were found, as Figure 3 shows. The number of new qualified records should roughly be in line with the number of lines of data in your log files. It's not uncommon to see a few lines dropped due to errors; as long as you don't see a significant number of errors, you should be ready to create your first report. If the number of new qualified records is 0, there's a problem with your configuration and you need to figure out what the problem is.

Step 5. Create a Web Server for AWStats
To make it easy for you and others in your organization to browse the reports for your Web site, you can build another Web site within IIS and point it to a directory that stores the AWStats output. To make a new directory for your AWStats reports, first create a directory called AWStats in the Inetpub directory (i.e., C:\Inetpub\AWStats). Copy the icon directory in C:\Program Files\AWStats\wwwroot and paste it into the C:\Inetpub\AWStats directory. Next, define a new Web site in IIS and point it to this directory, as Figure 4 shows. Create a unique TCP port, IP address, or host header assignment for this Web site if there's already an existing site on that server listening on port 80.

When you use the report-generation application, AWStats creates a custom Web page. The default filename for that Web page is awstats.WebSiteName.html, where WebSiteName is the Web site name that you defined in Step 3. You need to set that Web page as the default home page in the Documents tab of the AWStats Site Properties dialog box.

Finally, if you want to add any security to your statistics site, you can do so by modifying the appropriate properties on the Directory Security tab of the AWStats Site Properties dialog box. For example, you can restrict users based on IP addresses or require authentication to access the site. If you don't add any security, anyone who can connect to the server will be able to browse the site.

   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 log on before posting a comment.

If you don't have a username & password, please 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. ...

New Microsoft/Yahoo! Deal? No

On Sunday, the Times of London reported that Microsoft had renewed talks with failing Internet giant Yahoo! and would manage its search engine for 10 years, while Yahoo! would retain control of its email, messaging, and content services. This report ...

How can I stop and start services from the command line?

...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events How IE7 & The New Extended Validation SSL Certificates Impact Your Site

Concrete Ways to Make Sure Your SharePoint Deployment Doesn't Blow Up

Virtualization Management

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

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

Related IIS and Web Administration Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


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 Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing