Solved

Custom AWSTATS log format for IIS and running existing logs in batch

Posted on 2007-04-09
6
6,256 Views
Last Modified: 2013-12-07
Hi
Can anyone help me to create a custome log file for IIS logs that were captured in the following format:

#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2006-11-23 11:16:09
#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
2006-11-23 11:16:09 W3SVC463436271 196.2.xx.xxGET /index.asp - 80 - 217.31.169.71 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+95) 200 0 0
2006-11-23 11:16:09 W3SVC463436271 196.2.xx.xx GET /styles.css - 80 - 217.31.169.71 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+95) 200 0 0
2006-11-23 11:16:09 W3SVC463436271 196.2.xx.xx GET /header.asp - 80 - 217.31.169.71 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+95) 200 0 0
2006-11-23 11:16:11 W3SVC463436271 196.2.xx.xx GET /home.asp - 80 - 217.31.169.71 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+95) 200 0 0
2006-11-23 11:16:11 W3SVC463436271 196.2.xx.xx GET /nav.asp - 80 - 217.31.169.71 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+95) 200 0 0
2006-11-23 11:16:11 W3SVC463436271 196.2.xx.xx GET /footer.asp - 80 - 217.31.169.71 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+95) 200 0 0

I also need help with running awstats on all the log files for a couple of months.

I have a folder with the last 4 or so month's worth of daily stats in exYYMMDD.log format

I tried running awstats by changing the config file for awstats for the particular domain to just point to "/path/to/logs/ex*.log", but that doesn't work. Only when I explicitly mention a file in the path does awstats run ( but then it complains about the missing fields in the log files - hence my question about telling awstats to use the existing log formats as per example above).
0
Comment
Question by:psimation
6 Comments
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 18884600
AWStats does not read the default IIS log format without some configuration.  Put the following Log format in your awstats awstats.model.conf file:

# Use this LogFormat for limited IIS log (default log format from IIS 6)
LogFormat="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-bytes"

Don't put line break in.

A format like this works well for IIS logs:
LogFile="C:/WINNT/system32/LogFiles/W3SVC3/ex%YY-24%MM-24%DD-24.log"

When you run awstats, you can also specify which file you want it to run on (as long as it is where you specified for the LogFile location above):

perl c:\awstats-6.5\wwwroot\cgi-bin\awstats.pl -config=mymodel  -LogFile="C:/WINNT/system32/LogFiles/W3SVC3/ex061123.log" -update

Again, no line breaks.



 
0
 
LVL 17

Author Comment

by:psimation
ID: 18884961
Hi Mrcoffee365

Thx alot for that, the first part should definately work.

However, do you perhaps know how I can modify the .conf fil to include ALL the log files I already have on file?
I'd hate to have to run that command 180 time manually ( I've basically got 180 days worth of log files that I need AWSTATS to process...)
0
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 250 total points
ID: 18886450
I don't think there's an AWStats way to run it against multiple files at once.  You can write a script file which creates each log file name.  Or cut and paste the lines into a big .bat file.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Expert Comment

by:npglobal
ID: 20183280
I am running IIS log with the following formats

#Fields: date time 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

and i unable to run this.. please help me out to sort out this problem
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 20184335
You need to open a new question, not ask your question as part of an already answered question.

http://www.experts-exchange.com/Web_Development/WebTrends_Stats/
0
 

Expert Comment

by:dolharz
ID: 26331796
> However, do you perhaps know how I can modify the .conf fil to include ALL the log files I already have on file?

To perform a wildcard analysis of multiple-file log, set the LogFile to this:

LogFile="e:\awstats\tools\logresolvemerge.pl C:/WINNT/system32/LogFiles/W3SVC3\*.log |"

Change the  path to AWstats correctly.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question