Monday, October 17, 2011

AWStats

I have been on a quest to use AWStats to gather statistics from IIS logs.  I ran into a big roadblock with Elastic Load Balancers and external IP addresses.  I documented the solutions to those issues in previous posts.  The new ELB is in place and it's time for payoff from a lot of hard work.  Here are notes about AWStats setup.


Basic setup is here: http://awstats.sourceforge.net/docs/awstats_setup.html
Kept the setup as close to default as possible

conf file Edits

To add multiple logs - use logresolvemerge.pl
LogFile="/usr/bin/logresolvemerge.pl /mounts/logs/iis/server01/W3SVC1/
u_ex%YY-0%MM-0%DD.log /mounts/logs/iis/server02/W3SVC1/
u_ex%YY-0%MM-0%DD.log /mounts/logs/iis/server03/W3SVC1/u_ex%YY-0%MM-0%DD.log|"
Using Default IIS LogFormat might not work - use this
LogFormat="date time s-sitename s-computername s-ip cs-method cs-uri-stem
cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie)
cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken"
Delete some of the comments at the top of the file to make edits easier
Delete the localhost file if it is not needed
Keep awstats.model.conf for its comments and instructions for editing

html files

perl awstats.pl -config=mysite -update for first log analysis
Files are stored in /var/www/awstats
A awstats.conf files is created for Apache
Create a cronjob for hourly updating
00 * * * * /usr/bin/awstats_updateall.pl now -awstatsprog=/var/www/awstats/awstats.pl
Files cannot be viewed without calling the awstats perl script
Example - http://yourserver/awstats/awstats.pl?=config=services

No comments:

Post a Comment