Friday, October 31, 2008

Analyzing IIS log files

AWStats is an open source free tool that can be used to analyze IIS log files. It can be downloaded from http://awstats.sourceforge.net/

Setup

  1. Perl is a prerequisite for AWStats. A version of this can be downloaded from http://www.activestate.com/Products/activeperl/index.mhtml. This tool also adds perl command to PATH environment variable
  2. Download AWStats from http://awstats.sourceforge.net/#DOWNLOAD
  3. Install AWStats to your hard disk (say D:\Program Files\AWStats)
  4. Create a folder for AWStats on your hard disk. It will be used as web deployment folder for AWStats (say C:\Inetpub\wwwroot\awstats)
  5. Copy D:\Program Files\AWStats\wwwroot\*.* to C:\Inetpub\wwwroot\awstats\
  6. Make a copy of C:\Inetpub\wwwroot\awstats\cgi-bin\awstats.model.conf and name it as C:\Inetpub\wwwroot\awstats\cgi-bin\awstats.mysite.conf where mysite is domain of the website (it can be anything though)
  7. Edit awstats.mysite.conf and set following properties
  • LogFile="D:\Production Log\39\ex081030.log" (path to log file being analyzed)
  • 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" (This format can be copied from IIS log file. Open log file in text editor and copy from this line at top #Fields: 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
  • SiteDomain=www.mysite.com
  • There are other properties which can be customized. Refer to doc in D:\Program Files\AWStats\docs
  1. On command prompt enter following commands

    perl awstats.pl -config=mysite -update
    perl awstats.pl -config=mysite -output -staticlinks > awstats.mysite.html
    perl awstats.pl -config=mysite -output=alldomains -staticlinks > awstats.mysite.alldomains.html
    perl awstats.pl -config=mysite -output=allhosts -staticlinks > awstats.mysite.allhosts.html
    perl awstats.pl -config=mysite -output=lasthosts -staticlinks > awstats.mysite.lasthosts.html
    perl awstats.pl -config=mysite -output=unknownip -staticlinks > awstats.mysite.unknownip.html
    perl awstats.pl -config=mysite -output=alllogins -staticlinks > awstats.mysite.alllogins.html
    perl awstats.pl -config=mysite -output=lastlogins -staticlinks > awstats.mysite.lastlogins.html
    perl awstats.pl -config=mysite -output=allrobots -staticlinks > awstats.mysite.allrobots.html
    perl awstats.pl -config=mysite -output=lastrobots -staticlinks > awstats.mysite.lastrobots.html
    perl awstats.pl -config=mysite -output=urldetail -staticlinks > awstats.mysite.urldetail.html
    perl awstats.pl -config=mysite -output=urlentry -staticlinks > awstats.mysite.urlentry.html
    perl awstats.pl -config=mysite -output=urlexit -staticlinks > awstats.mysite.urlexit.html
    perl awstats.pl -config=mysite -output=browserdetail -staticlinks > awstats.mysite.browserdetail.html
    perl awstats.pl -config=mysite -output=osdetail -staticlinks > awstats.mysite.osdetail.html
    perl awstats.pl -config=mysite -output=unknownbrowser -staticlinks > awstats.mysite.unknownbrowser.html
    perl awstats.pl -config=mysite -output=unknownos -staticlinks > awstats.mysite.unknownos.html
    perl awstats.pl -config=mysite -output=refererse -staticlinks > awstats.mysite.refererse.html
    perl awstats.pl -config=mysite -output=refererpages -staticlinks > awstats.mysite.refererpages.html
    perl awstats.pl -config=mysite -output=keyphrases -staticlinks > awstats.mysite.keyphrases.html
    perl awstats.pl -config=mysite -output=keywords -staticlinks > awstats.mysite.keywords.html
    perl awstats.pl -config=mysite -output=errors404 -staticlinks > awstats.mysite.errors404.html


    I prefer to create a batch file with all these commands and pass site name as parameter.

    Once executed, it will create multiple .html files in C:\Inetpub\wwwroot\awstats\cgi-bin (provided you have not configured any other path in awstats.mysite.conf). Open http://localhost/.../awstats.mysite.html (depends on where you created web deployment folder) which is the index page and you are done.
    Hope this helps when you have to analyze log files next time :)

Tuesday, October 07, 2008

LIVE Data Update (.Net)

What if you want to update data on webpage real time? The exisitng option is "PULL" where client polls server for updates and when retrieved it updates data on page. This works but issues
  1. There is a lag between data update and data refresh and this depends on delay between each refresh call.
  2. Unnecessary load on server and network even though there is no data update.
PUSH technolgy is around for ages but somehow it is not mapped to Web based applications. Reason being that Web is inherently server-client model. Client asks, server serves.
But the scenario is changing. HTML 5 is coming up with Web-Sockets and Server-Sent Events (http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html).

But what if you want to implement PUSH implementation now?
Well. you have couple of options:
1. COMET - Works but is not scalable as it relies on keeping a thread open on the server till client closes the connection. Not feasible for high volume websites.
2. http://www.themidnightcoders.com/weborb/dotnet/
3. http://www.lightstreamer.com/

Hope this helps you in your next project :)

Thursday, October 02, 2008

Which cell to buy....

Well finally i made up my mind to say bye-bye to my old Nokia 6030 and go for a Biz Class cell phone (a big leap of faith for me). Many a times I really think - do I need a big phone and then my brain says - comeon, you need to show off man ;)
But the problem was not to make up my mind. Problem is to select a phone. There are so many choices that uffffffffff, which one to go for.
The other problem is upcoming cellphones. they are hyped so much that i am not sure if i should wait for their launch or not.
Someone has said true - "Mobile and wife, if u wait for sometime you could get a better model ;)"

Anyway my confusion is between these:
Blackberry Bold
HTC Diamond
Samsung Omnia
Apple IPod 3G

Upcoming models
HTC Google Android Based
Blackberry Thunder
Well if someone can suggest something on this subject, I am eager to listen. But please do not suggest any other model. I am somehow leaning towards Omnia as Blacberry is too business and iphone has too many limitations. But someone said about Omnia, hey that is Samsung :)