<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JasonSamuel.com &#187; Log Parser</title>
	<atom:link href="http://www.jasonsamuel.com/tag/log-parser/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonsamuel.com</link>
	<description>Cool stuff I see in the IT world</description>
	<lastBuildDate>Wed, 25 Jan 2012 21:05:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Using Log Parser to query huge log files and only display the results you need</title>
		<link>http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need</link>
		<comments>http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 20:57:18 +0000</pubDate>
		<dc:creator>Jason Samuel</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[SQL Express]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[Log Parser]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.jasonsamuel.com/?p=332</guid>
		<description><![CDATA[Have you ever had a giant log file or CSV that you needed to go through and pull results from quickly?  Sure you can try dumping it into Excel and trying different filters and sort orders but that&#8217;s a waste of time.  It&#8217;s much faster to pull your data via a query like in a [...]<p><a href="http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/">Using Log Parser to query huge log files and only display the results you need</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>

More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2010/01/08/creating-a-custom-event-log-under-event-viewer-to-log-server-events/' rel='bookmark' title='Creating a custom event log under Event Viewer to log server events'>Creating a custom event log under Event Viewer to log server events</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Have you ever had a giant log file or CSV that you needed to go through and pull results from quickly?  Sure you can try dumping it into Excel and trying different filters and sort orders but that&#8217;s a waste of time.  It&#8217;s much faster to pull your data via a query like in a database.  Microsoft has a tool called Log Parser that does just that.  You can use queries to parse any kind of text based file.</p>
<p>You can download Log Parser 2.2 from Microsoft here:  <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en</a></p>
<p>Just install it and try it out by opening up a command prompt, navigating to your install path, and running the logparser executable.  It will display a list of commands to get you familiar with it.   I first started using it to parse huge IIS logs.  It&#8217;s pretty easy to use, here&#8217;s an example of pulling the top 10 pages hit on your site:</p>
<p><code>logparser &quot;SELECT TOP 10 cs-uri-stem as Url, COUNT(cs-uri-stem) AS Hits FROM c:\logs\ex*.log GROUP BY cs-uri-stem ORDER BY Hits DESC&quot;</code></p>
<p>or all the Error 500s for a particular site:</p>
<p><code>logparser &quot;SELECT [cs-uri-stem], [cs-uri-query], Count(*) AS [Hits] FROM c:\logs\ex*.log WHERE sc-status = 500 GROUP BY [cs-uri-stem], [cs-uri-query] order by [hits], [cs-uri-stem] DESC&quot; -rtp:-1 -i:iisw3c</code></p>
<p>You can even throw the above in a batch file that schedule to run every hour and do something like:</p>
<blockquote><p>All5005Errors.bat > All500Errors.txt</p></blockquote>
<p>to log it all to disk.  Or even easier, use INTO in your SQL syntax to dump to a file like a .csv so it reads like:</p>
<p><code>logparser &quot;SELECT [cs-uri-stem], [cs-uri-query], Count(*) AS [Hits] INTO All500Errors.csv FROM c:\logs\ex*.log WHERE sc-status = 500 GROUP BY [cs-uri-stem], [cs-uri-query] order by [hits], [cs-uri-stem] DESC&quot; -rtp:-1 -i:iisw3c</code></p>
<p>There&#8217;s tons and tons of nice little queries people have written, for example I&#8217;ve personally used some from Jeff Atwood&#8217;s site here:  <a href="http://www.codinghorror.com/blog/archives/000369.html">http://www.codinghorror.com/blog/archives/000369.html</a></p>
<p>Or you can got to the IIS.NET forums where there is an entire forum and many sub-forums dedicated to Log Parser here:  <a href="http://forums.iis.net/default.aspx?GroupID=51">http://forums.iis.net/default.aspx?GroupID=51</a></p>
<p>Another cool tool over at CodePlex&#8230;Visual Log Parser:  <a href="http://www.codeplex.com/visuallogparser">http://www.codeplex.com/visuallogparser</a></p>
<p>I actually haven&#8217;t used this yet but it is out there if you get bored of using command line.  LMK if you guys decide to try it out.</p>
<p><a href="http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/">Using Log Parser to query huge log files and only display the results you need</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>
<p>More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2010/01/08/creating-a-custom-event-log-under-event-viewer-to-log-server-events/' rel='bookmark' title='Creating a custom event log under Event Viewer to log server events'>Creating a custom event log under Event Viewer to log server events</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.jasonsamuel.com/2010/01/12/using-log-parser-to-query-huge-log-files-and-only-display-the-results-you-need/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.jasonsamuel.com @ 2012-02-06 17:50:04 -->
