Monday, March 26, 2007

The coolest log parser

Once again Microsoft has come up with an awesome and very smart utility called Log Parser. It uses SQL-like syntax to allow you to query many kinds of sources. Example sources are web logs from IIS, EventLog in Windows, Active Directory, LDAP, etc. Here is how I got hits on a specific page in my application by month: LogParser "SELECT TO_STRING(date, 'yyyy-MM') as MONTH, COUNT(*) AS Hits FROM <FrontLine> where cs-uri-stem = '/KnowledgeBase.aspx' GROUP BY TO_STRING(date, 'yyyy-MM'), cs-uri-stem ORDER BY TO_STRING(date, 'yyyy-MM') DESC" In case that wasn't cool enough, you can output results to a chart (file), Database, Excel, etc. Here is where you can get the latest binary from: Here is a good example for web logs usage: Here is how to use it from C#: This seems to be a good tutorial:

1 comment:

digital signature PDF said...

There are lot of parsing methods are available. This post describes the coolest log parser in detail. I am very impresses with your work. Parsing is not easy method but your post help a lot in learning them. Thanks for your post.