<?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>GL.IB.LY &#187; apache</title>
	<atom:link href="http://gl.ib.ly/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://gl.ib.ly</link>
	<description>Thoughts on security, computing, business and stuff!</description>
	<lastBuildDate>Sun, 18 May 2014 11:51:56 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Searching compressed Apache logs</title>
		<link>http://gl.ib.ly/stuff/2009/06/23/searching-compressed-apache-logs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=searching-compressed-apache-logs</link>
		<comments>http://gl.ib.ly/stuff/2009/06/23/searching-compressed-apache-logs/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 06:27:23 +0000</pubDate>
		<dc:creator><![CDATA[tariq]]></dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bunzip2]]></category>
		<category><![CDATA[compressed]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[one liners]]></category>
		<category><![CDATA[tidbits]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://gl.ib.ly/?p=35</guid>
		<description><![CDATA[<p>From time to time things tend to go wrong and systems tend to go crazy. Sometimes these errors are more of nuisance than anything else, an intermittent annoyance you&#8217;d prefer not to investigate &#8212; trawling through logs is a pain in<span class="ellipsis">&#8230;</span><div class="read-more"><a href="http://gl.ib.ly/stuff/2009/06/23/searching-compressed-apache-logs/">Read more &#8250;</a></div><!-- end of .read-more --></p><p>The post <a href="http://gl.ib.ly/stuff/2009/06/23/searching-compressed-apache-logs/">Searching compressed Apache logs</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>From time to time things tend to go wrong and <a title="http://gl.ib.ly/archives/10-Deleting-specific-emails-from-the-postfix-mail-queue.html" href="http://web.archive.org/web/20090814080809/http://gl.ib.ly/exit.php?url_id=65&amp;entry_id=27">systems tend to go crazy</a>. Sometimes these errors are more of nuisance than anything else, an intermittent annoyance you&#8217;d prefer not to investigate &#8212; trawling through logs is a pain in the backside. Now you need to take a peak at those compressed Apache error log files, ugh! Well before you look for suitable places to hang some rope try running some expressions across a certain number of files. Normally you&#8217;d only want to look at logs for the last 7 days, so lets give that a go.</p>
<div>The error messages I am interested in all contain the text <code>Healthcheck</code> so I will use trusty <code>grep</code>find matching lines in the logs. I will use <code>find</code> to get me all the files modified in the last seven days. A program called <code>xargs</code> will then be used to call <code>cat</code> which will pipe to a compression program which finally pipes to <code>grep</code>. Put this all together and you get something like this:</p>
<div>
<pre>find /var/log/apache2 -type f -name "error_*.bz2" -mtime -7 | sort | xargs cat | bunzip2 | grep"Healthcheck"</pre>
</div>
<p>If your files are <i>tar.gz</i> then you&#8217;ll need to replace <code>bunzip2</code> with gzip -dc. So that would look like:</p>
</div>
<div>
<pre>find /var/log/apache2 -type f -name "error_*.tar.gz" -mtime -7 | sort | xargs cat | gzip -dc |grep "Healthcheck"</pre>
<p>Have fun!</p>
</div>
<p>The post <a href="http://gl.ib.ly/stuff/2009/06/23/searching-compressed-apache-logs/">Searching compressed Apache logs</a> appeared first on <a href="http://gl.ib.ly">GL.IB.LY</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gl.ib.ly/stuff/2009/06/23/searching-compressed-apache-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
