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
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

Google's Browser Created Out of Fear of Microsoft

A deep fear of Microsoft drove Google to create its own Web browser, the company's cofounders implicitly admitted Tuesday, though each was careful never to mention the software giant by name. Instead, during a press conference, Google's leaders discussed ...

Let's Get Out of the (Network) Neighborhood

Network Neighborhood might've made sense way back when, but it's long past obsolete today. ...


IIS and Web Administration Whitepapers The Five Secrets to Controlling Your SharePoint Environment

Extended Validation SSL Certificates

A Preliminary Look at Deployment Plans for Microsoft Windows Vista

Related Events 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.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

IT Connections
Dive into the new Microsoft platforms and products you implement and support with the experts from Microsoft, TechNet Magazine, Windows ITPro and industry gurus. There are 70+ sessions and interactive panels with networking opportunities.

Attention User Group Leaders...
Announcing the eNews Generator—a FREE HTML e-newsletter builder for user group leaders. Build your HTML and text e-newsletters in minutes and add Windows IT Pro & SQL Server Mag articles alongside your own message!.

Master SharePoint with 3 eLearning Seminars
Learn how to build a better SharePoint infrastructure and enable powerful collaboration with MVPs Dan Holme and Michael Noel. Register today!

Get SQL Server 2008 at WinConnections
Don’t miss Microsoft Exchange and Windows Connections conferences, the premier events for Microsoft IT Professionals in Las Vegas, November 10-13. Every attendee will receive a copy of SQL Server 2008 Standard Edition with one CAL.



Order Your SQL Fundamentals CD Today!
Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.

Virtualization Congress Oct. 14-16 in London
Don't miss Virtualization Congress, the premiere EMEA conference dedicated to hardware, OS and application virtualization. Oct. 14-16.
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 Technical Resources 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