Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Analyze Your IIS6 Web Logs with AWStats : Page 3

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.


advertisement
Running AWStats
Running AWStats is quite simple: you need to run only awstats.pl and awstats_buildstaticpages.pl; however you do need to provide some parameters. The main parameter is -config, which defines the configuration file used by the program to analyze data and create reports.

Eventually, you'll schedule report generation automatically, but at first, it's useful to run AWStats directly from the command line, both to see how it works and to test that your configuration files are OK. First, create an awstats.www.companysite.com.conf file in your \bin folder as described in the previous section. You will need to have an IIS log file to analyze, so you can point your .conf file at the log file you specified using the IIS MMC.

Now select Start, Run and enter the command cmd.exe /f:on. In the command window that opens, change directories to the \bin folder that contains all the AWStats resources.

To run your first analysis, enter the command:

awstats.pl -config=www.companysite.com

That command causes AWStats to open your log file, analyze it, show the results, and then end. If everything worked, you'll find a new file in your \bin\dirdata folder. The actual file name depends on the configuration file name, the analyzed month, and so on. If any problems occur (you can check this from the results report), make sure that your Perl interpreter is installed and working, your .conf files are defined correctly, and that your IIS log file is in the correct format, and exists in the location where AWStats expects to find it. If you find that AWStats failed to decode only some rows (the results will indicate such problems), don't panic. If most rows are decoded, that's ok; otherwise you probably have problems with your IIS log format.

Run the same command again; you'll see that this time AWStats runs very fast, skipping all the records it's already analyzed. That's because it builds on old data, checking and analyzing only new records in the IIS log.

After analyzing the log data, you can make AWStats create a report. Create a folder to contain the report (for this example, I used E:\Reports, and copy the \bin\icon folder to it. Also create a www.companysite.com directory in this folder, to archive all report files for this particular configuration/Web site (you can create a different folder for each configuration/Web site you manage). Now, from the same command window you used previously, run this command:

awstats_buildstaticpages.pl -update -config=www.companysite.com -- dir=E:\Reports\www.companysite.com -diricons=../icon

Make sure to change the path to the report path you created. The preceding command causes AWStats to create an HTML-formatted report in the specified folder. You can open the HTML file with a browser to see the analyzed data.

As you can see, after setting up the correct folders and configuration, analyzing log data and creating reports requires running only two scripts. In fact, you actually need to run only buildstaticpages.pl, because that runs awstats.pl in the background. Remember, you launched it manually only to check the output and verify that the environment is OK.

So, scheduling report generations is simple; however, you still need to keep security in mind—a topic I'll discuss a little later.

Some Tips for Running AWStats
AWStats is powerful and simple to use, but it does have some problems running on Windows. To save you time, I've created a list of tips that you can use to run AWStats with fewer problems.

  • AWStats creates a cache of data it analyzed for each web site (one cache for each .conf file you create). Every time you run it, it checks to see if the cache contains previously analyzed data; if so, it uses those to avoid reanalyzing the entire log file. Instead, it starts reading the log immediately after the last line read during the previous execution. So, if you need to clear all the data and reanalyze your logs, you must delete the cache files. You can find them in the \dirdata folder you created during your installation.
  • AWStats needs to analyze data in strict sequence. So, for example, if you have already analyzed the October log file, you can't later analyze the September log. If you need to work out-of-sequence, you must first delete the cache files from your \dirdata folder, and then analyze the September log before the October one.
  • AWStats skips log files with incorrect formatting. If that happens, stop IIS 6, rename (or delete) the current log file, make sure the log file options are correct, and then restart the Web server. IIS 6 will then create a new log file with the correct format, which you can analyze with AWStats.
  • AWStats can do DNS lookups of IP addresses that it finds in log files. This can be a nice feature, because it gives you more information about where the requests are coming from, but it also requires a lot of time because AWStats must query the DNS server for each IP. So, despite the advantages, it's usually better not to enable this feature.
  • By default, AWStats focuses on "monthly" reports, analyzing and creating reports with a month-centric view (in fact, it focuses the report on the current month by default). If you want to have different reports, you can specify a specific month or date range.


Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap