I had forgotten how much I loved using Log Parser as I haven’t had the need to in ages. However, using it again made me realize the flexibility and usefulness of this tool.
In case you hadn’t used this tool before, it was created by Microsoft as a tool for sysadmin to be able to use SQL-like syntax to query log files in a variety of format. In this case, I needed to find out if a particular page was ever being called on a live website. In this particular case we aren’t running Google Analytics (where I would normally look for this answer) because this is a redirector site that never really shows a page.
Not relishing having to search through hundreds of daily log files and searching for the filename in question, I instead turned to Log Parser and asked it the following:
[well type=””]
LogParser -i:IISW3C “SELECT cs-uri-stem as [Request URI] from *.log WHERE cs-uri-stem LIKE ‘/ClickTrack.aspx%'”
[/well]
The key to searching across multiple files was to pass the -i parameter indicating that the files were in standard IISW3C format. That allowed me to use *.log as the input for the query whereas normally I’d only be able to query one file at a time.
Don’t like using the command line interface for this tool or want a way to make it easy to store your favorite queries? Then you’ll probably want to look into the Office Log Parser Studio tool that gives you a nice GUI for launching and managing your scripts.
Happy SysAdmin Day tomorrow! I hope you find this tool as useful as I do…
- Setting up SSL on Amazon Linux Instance under EC2 - July 26, 2018
- Method Chaining of Objects in C# - January 16, 2017
- Native SQL Backup And Restores on AWS RDS - November 9, 2016