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.

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: