Home > Scripting > Parse specific key words from a log file??

Parse specific key words from a log file??

Some day to day tasks require you to parse an IIS, exchange, or 3rd party app log for specific data such as an IP, username, or machine name.  We have written a simple command that parses all of the log files in a directory based on certain search criteria and then outputs each line that contains the query results.

for %%f in ("c:\WINDOWS\system32\LogFiles\W3SVC1*.log") do find /i "192.168.0.23" "%%f" >> outputted_lines.txt

The above command should be saved to a batch file.  It will parse your default website’s IIS log directory for any line containing an IP address of 192.168.0.23.   This can be great for trend analysis or troubleshooting a specific server or user issue.

Ed M.

Categories: Scripting
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment