Making AWStats work with default IIS logging.

By default, IIS logs the following:

#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status

This is nice, but bytes_sent is not logged by default by IIS, although AWStats needs this, and will give you the following error message:

Error: Your personalized LogFormat does not include all fields required by AWStats (Add `%bytesd` in your LogFormat string).

Fortunately, sc-substatus is always 0 and it’s logged, so at least you can get statistics for page hits, operating systems, browsers.. except traffic.

The LogFormat for the awstats.YourSite.conf file should be the following:

LogFormat = %time2  %other %other %method %url %query %other %logname %host %ua %code %bytesd %other

NOTE: You’ll have to import the log data in chronological order before you start scheduling awstats updates, so it’s a good idea to make a batch file to do this for you:

awstats.pl -config=DefaultWebSite -update -logfile=c:\WINDOWS\system32\Logfiles\W3SVC1930027649\ex091124.log
awstats.pl -config=DefaultWebSite -update -logfile=c:\WINDOWS\system32\Logfiles\W3SVC1930027649\ex091125.log
awstats.pl -config=DefaultWebSite -update -logfile=c:\WINDOWS\system32\Logfiles\W3SVC1930027649\ex091126.log

Originally posted to: http://www.thesysadminhimself.com/2009/12/making-awstats-work-with-default-iis.html

Updated:

Comments