Share via

Log Parser Examples

These examples show Log Parser searching for data, creating reports, and calculating statistics.  These are just three of the innumerable ways this versatile tool can make your life easier.  Maybe you'll be the next to discover a new and cool way to use Log Parser!

On This Page

Search for Data
Create Reports
Calculate Statistics

Search for Data

Search for the logons of a specific user among the events in the Windows Event Log:

C:\>LogParser "SELECT TimeGenerated, SourceName, 
EventCategoryName, Message INTO report.txt FROM Security WHERE 
EventID = 528 AND SID LIKE '%TESTUSER%'" -resolveSIDs:ON

And obtain results in a text file formatted as desired:


Create Reports

Create custom-formatted HTML reports:


Calculate Statistics

Calculate the distribution of the HTTP response status codes from your IIS log files:

C:\>LogParser "SELECT sc-status, COUNT(*) AS Times INTO Chart.gif 
FROM <1> GROUP BY sc-status ORDER BY Times DESC" -
chartType:PieExploded3D -chartTitle:"Status Codes"

And produce a chart formatted as desired: