Tag Archive for: parser

Log Parser

Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

We primarily use it for that analysis of IIS logs but could use it for any thing including our log4net logs.

Downloads

Log Parser is a command line utility

http://www.microsoft.com/en-us/download/details.aspx?id=24659

To make it easier to work with, Microsoft developed a GUI for Log Parser.  It is called Log Parser Studio.

http://gallery.technet.microsoft.com/office/Log-Parser-Studio-cd458765

Basic Usage

Log Parser Studio needs access to the log files.  Since log files are produced and stored on the web server, you either need to install Log Parser Studio on the web server or download logs to your workstation.

  1. Open Log Parser Studio
  2. You will see a library of recipe queries.  Scroll down to see the IIS queries.
  3. Double click on the name of a query.  e.g. “IIS: HTTP Status Codes by Count”
  4. Click the folder open button (mustard color) in the toolbar
  5. Choose the folder where IIS logs are located
  6. Select files/folders
  7. Click the execute button (red exclamation) to run the query.
  8. Results will be displayed and can be exported

Advanced Usage

As you can see from the queries in the library the query language is SQL based.  Experiment with writing your own queries to get the information that you need just like you would in SQL.  As you would in SQL, just start by doing an exploratory query.

SELECT top 10 * FROM ‘[LOGFILEPATH]’

Then start experimenting.

Google for other examples.  Chances are somebody on the Internet has already written the query that you need.