November 15, 2024

Well… the first question about anything that comes in mind is What’s that? The best description is given by the Official Page of the tool which is as follows : Log Parser is a powerful, versatile tool that provides universal query access to

1. Text Based Data

  • Log Files
  • XML Files
  • CSV Fies
  • TSV Files

2. Data Sources

  • W3C Files
  • IIS Files
  • IISW3C Files
  • Event Log Files
  • Registry Files
  • File System
  • Active Directory
Well, Log Parser is a command-line tool, that can be used to extract data out files and data sources.
It provides a very SQL-Like Language and the various files and data include IIS Log files, Active directory, File System, Event Log, Registry, Log4Net Log Files, Custom XML Files, CSV Files and much more….
Wow! Cool…!  Isn’t it..? 🙂
How it works?
Well, Log Parser can be divided into three main components, namely the Input, the Processing Engine and the Output.

       1. The Input:
Takes a file or multiple files of same type as an input. Most of them are specified above, but there are some more also which are supported as Input.

  1. 2. The Processing Engine:
The main Query engine, which parses the input file/s as with the given query.
The query is typically uses an SQL Dialect.
Actually, the best part is it not only uses the very familiar SQL format, but also uses many functions and expressions which make it very easy to filter out data as per our specific requirement.
  • Functions:
Some common functions which generally are extensively used include:
ADD
AVG
CASE
COMPUTER_NAME
COUNT
FLOOR
GROUPING
LTRIM MAX MIN
RTRIM
SQR
SQRROOT STRCAT
STRCNT
STRLEN
STRREPEAT STRREV
SUM
TO_DATE TO_STRING
and others
For more details, please refer to the following link : Log Parser Functions
  • Expressions:
ALL
ANY
BETWEEN IN LIKE
For detailed explanation of the same, please refer to the following link : Log Parser Expressions
      3. The Output:
There are a number of output formats which are supported.
They include:
  • W3C
  • IIS
  • CSV
  • TSV
  • CHART
  • SQL (sending the result of a query to an SQL Table)
  • Template (User defined template, wow! this is cool… 🙂 )
Lets summarize it in a diagram..
Log Parser

Hope the diagram makes it clear….

Examples:

Some snaps of how log parser are as follows:

  • Snaps for Log Parser Query
Sample for Top Ten Pages
Log Parser Query and How can we use help from Log Parser
  • Snaps for Results from Log Parser Queries

Top Ten Pages
Hits on particular pages

References :

  1. How to use Log Parser
  2. Log Parser Wiki
  3. Log Parser – Microsoft
  4. Professor – How Log parser works?
  5. Log Parser Forum

Happy Log Parsing! 🙂

2 thoughts on “Log Parser

Leave a Reply

Your email address will not be published. Required fields are marked *