Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Analyze Your IIS6 Web Logs with AWStats : Page 4

Need to know what your Web site users are visiting in your sites? Try this free and open source Web log analyzer you can use with IIS6-hosted Web sites and applications.




Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

Scheduling AWStats
Even though you're using AWStats in offline mode, you probably want to create updated reports automatically. The simplest way to do this is to use the Windows scheduler. First, create a new standard user account on the Web server (or in Active Directory) with no extended rights (you can create the account in the Users group). It's a good idea to assign a strong password to this account. You'll use the account to create a scheduled task and nothing else.

Next, create one a batch file to launch data analysis for each Web site for which you want to create reports. Here's a typical batch file that analyzes three separate Web sites on the server:

start /low /wait awstats_buildstaticpages.pl -update -config=www. companysite.com -dir=E:\Logs\Reports\www.companysite.com -diricons=../icon start /low /wait awstats_buildstaticpages.pl -update -config=www.companysite2.com -dir=E:\Logs\Reports\www.companysite2.com -diricons=../icon start /low /wait awstats_buildstaticpages.pl -update -config=www.huge.it -dir=E:\Logs\Reports\www.huge.it -diricons=../icon

Save the file with a .bat extension. Note that the batch file uses start.exe rather than running the Perl scripts directly, because Perl is an interpreted language, and you cannot define a task priority or a maximum CPU usage value when you run a Perl program. Running the commands with start.exe, and passing the /low parameter runs Perl in low-priority mode, letting the Windows process scheduler assign more CPU time to standard programs, and running the log analyzer with less impact on the overall system. The /wait option causes start.exe to wait until program execution completes before running the next command. If you omit the /wait option the batch file will launch all the defined AWStats processes (three in this case) at one time, which will consume too many server resources.

Using a similar batch file and the user you defined, you can create an NT scheduler task to update your log reports at off-peak times and at convenient intervals.

Security and NTFS settings
When you schedule (or run) a program, it's best to restrict its permissions as much as possible. To create reports, you can assign NTFS permissions to the user account you created to run the scheduled task. You'll have to assign these permissions:

  • Execute, on c:\program files\perl
  • List folder contents only (or the less restrictive read option) on the root folder where you put the AWStats files (the root of the disk containing the \bin folder)
  • Execute, on the \bin folder
  • Modify, on the \bin\dirdata folder
  • Read, on the folder containing the IIS logs
  • Modify, on the folder where you want AWStats to create the report files
Setting only these permissions restricts file and folders access to the user account running AWStats—and it's a common "best practice" for every server and application.

AWStats has many additional options and features beyond the ones mentioned here. You can find the complete documentation online, so you can easily find and test additional features yourself. The documentation is quite Linux-centric, but after you get AWStats working on Windows as described in this article, you'll find that you can refer to the documentation with few problems.

Bruno A. Zambetti is founder of Huge! srl, an Italy-based company specializing in Internet and distributed solutions. He is a .NET Architect, a Fortinet-certified network specialist, and has authored several articles on .NET and web infrastructures.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date