<?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>audun.ytterdal.net</title>
	<atom:link href="http://audun.ytterdal.net/feed" rel="self" type="application/rss+xml" />
	<link>http://audun.ytterdal.net</link>
	<description>Sysadmin and Person</description>
	<lastBuildDate>Wed, 17 Mar 2010 14:42:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Pipestat</title>
		<link>http://audun.ytterdal.net/2009/04/pipestat</link>
		<comments>http://audun.ytterdal.net/2009/04/pipestat#comments</comments>
		<pubDate>Tue, 28 Apr 2009 15:51:54 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/?p=111</guid>
		<description><![CDATA[Some days it feels like reading and analysing logs is the only thing I do at work. And when I analyse logs it&#8217;s usually something like zcat -f *log* &#124; grep -v something &#124; awk '/something else/ { print $3 }' &#124; sed 's/something/else/g' &#124; sort &#124; uniq -c &#124; sort -gr > output And [...]]]></description>
			<content:encoded><![CDATA[<p>Some days it feels like reading and analysing logs is the only thing I do at work.<br />
And when I analyse logs it&#8217;s usually something like</p>
<p><code><br />
zcat -f *log* | grep -v something | awk '/something else/ { print $3 }' | sed 's/something/else/g' | sort | uniq -c | sort -gr > output<br />
</code></p>
<p>And when this does not fully comply to what i need to do i fall back to perl and write a ugly oneliner of the type</p>
<p><code><br />
tail -f foo | perl -lane 's/foo(.*)/bar$1bar/g'<br />
</code></p>
<p>So when my wife and daughter got a visit from <a href="http://en.wikipedia.org/wiki/Norovirus" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">Mr Noro</a> I had some spare time and wrote tailstat. It&#8217;s a small perlprogram that does what I manualy do every day</p>
<p>It has a few different modes</p>
<p>Plain<br />
<code><br />
[root@wildbill logs]# for i in foo foo bar bar foo foobar;do echo $i;done | pipestat<br />
foo                       : (50.0%) (107546.3 hits/s) (3 hits / 6)<br />
bar                       : (33.3%) (71697.5 hits/s) (2 hits / 6)<br />
foobar                    : (16.7%) (35848.8 hits/s) (1 hits / 6)</p>
<p>Parsed 6 lines in 0.00 secs (46863.7 lines/s)<br />
</code></p>
<p>a single regexp</p>
<p><code><br />
[root@wildbill logs]# for i in foo foo bar bar foo foobar;do echo $i;done | pipestat foo<br />
foo                       : (66.7%) (100462.4 hits/s) (4 hits / 6)<br />
                            : (33.3%) (50231.2 hits/s) (2 hits / 6)</p>
<p>Parsed 6 lines in 0.00 secs (25317.7 lines/s)<br />
</code></p>
<p>More real examples, </p>
<p><code><br />
[root@wildbill logs]# cat www-access_log | pipestat 'css' 'jpe?g' 'gif' 'png'<br />
jpe?g                     : (30.3%) (24590.5 hits/s) (122851 hits / 405830)<br />
css                       : (11.7%) (9494.6 hits/s) (47434 hits / 405830)<br />
gif                       : (6.6%) (5355.4 hits/s) (26755 hits / 405830)<br />
png                       : (0.4%) (341.3 hits/s) (1705 hits / 405830)<br />
&lt;rest&gt;                    : (51.0%) (41451.2 hits/s) (207085 hits / 405830)</p>
<p>Parsed 405830 lines in 5.00 secs (81230.8 lines/s)<br />
</code></p>
<p>Or if you just want field number 5&#8230;</p>
<p><code><br />
[root@wildbill logs]# cat www-access_log | pipestat --field=9 --limit=5<br />
200                       : (88.2%) (77506.3 hits/s) (350721 hits / 397549)<br />
HTTP/1.1"                 : (3.3%) (2858.5 hits/s) (12935 hits / 397549)<br />
404                       : (2.9%) (2530.8 hits/s) (11452 hits / 397549)<br />
301                       : (2.4%) (2092.8 hits/s) (9470 hits / 397549)<br />
403                       : (1.5%) (1321.3 hits/s) (5979 hits / 397549)<br />
&lt;limited&gt;                 : (1.8%) (1545.2 hits/s) (6992(1311) hits(uniq) / 397549)</p>
<p>Parsed 397549 lines in 4.53 secs (87795.5 lines/s)<br />
</code></p>
<p>This takes a apache accesslogg and print out the 9th whitespace seperated field and writes out the 5 most common hits, the rest of the hits are sumed up in
<limited>
<p>But as you can see there is something in the logs that confuses the fieldseperator</p>
<p>So then we go into matchmodus.</p>
<p><code><br />
[root@wildbill logs]# cat www-access_log | pipestat -m 'HTTP/1.1" (d+)'<br />
200                       : (92.3%) (218082.1 hits/s) (375934 hits / 407426)<br />
404                       : (3.1%) (7229.9 hits/s) (12463 hits / 407426)<br />
301                       : (2.5%) (5910.1 hits/s) (10188 hits / 407426)<br />
403                       : (1.4%) (3339.1 hits/s) (5756 hits / 407426)<br />
302                       : (0.4%) (873.1 hits/s) (1505 hits / 407426)<br />
405                       : (0.0%) (37.1 hits/s) (64 hits / 407426)<br />
206                       : (0.0%) (19.1 hits/s) (33 hits / 407426)<br />
304                       : (0.0%) (4.6 hits/s) (8 hits / 407426)<br />
&lt;rest&gt;                    : (0.4%) (855.7 hits/s) (1475 hits / 407426)</p>
<p>Parsed 407426 lines in 1.72 secs (236328.4 lines/s)<br />
</code></p>
<p>Or we could run it on the live log for say 60 seconds and what article is the most popular<br />
<code><br />
[ay@joanie ~]$ varnishlog -i RxURL -I artid | pipestat --runtime=60 --limit 5 -m 'artid=(d+)'<br />
542689                    : (7.9%) (1.5 hits/s) (91 hits / 1154)<br />
542739                    : (7.5%) (1.4 hits/s) (86 hits / 1154)<br />
542568                    : (4.4%) (0.8 hits/s) (51 hits / 1154)<br />
542723                    : (4.1%) (0.8 hits/s) (47 hits / 1154)<br />
542718                    : (3.7%) (0.7 hits/s) (43 hits / 1154)<br />
&lt;limited&gt;                 : (72.4%) (13.5 hits/s) (835(244) hits(uniq) / 1154)<br />
&lt;rest&gt;                    : (0.1%) (0.0 hits/s) (1 hits / 1154)</p>
<p>Parsed 1154 lines in 61.80 secs (18.7 lines/s)<br />
</code></p>
<p>Have fun. The code is <a href="http://audun.ytterdal.net/files/pipestat" >here</a></limited>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2009/04/pipestat/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tshark to the rescue</title>
		<link>http://audun.ytterdal.net/2009/03/tshark-to-the-rescue</link>
		<comments>http://audun.ytterdal.net/2009/03/tshark-to-the-rescue#comments</comments>
		<pubDate>Sat, 28 Mar 2009 22:30:05 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/?p=90</guid>
		<description><![CDATA[In my line of work as a sysadmin at one of the largest sites in Norway, it happens once in a while that I have to inspect HTTP traffic for some more or less urgent reason. One of the tools I really love working with is tshark. Tshark is the console version of wireshark and [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/d/db/Wireshark_Icon.png" class="alignright" width="100" height="100" />In my line of work as a sysadmin at one of the largest <a href="http://www.vg.no/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.vg.no');">sites</a> in Norway, it happens once in a while that I have to inspect HTTP traffic for some more or less urgent reason. </p>
<p>One of the tools I really love working with is <a href="http://www.wireshark.org/docs/man-pages/tshark.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.wireshark.org');">tshark</a>.<br />
Tshark is the console version of <a href="http://www.wireshark.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.wireshark.org');">wireshark</a> and enables you to sniff and dissect just about any protocol in realtime.</p>
<p>One of the problems I had recently was to identify webtraffic originating <strong><em>from</em></strong> our webserver.<br />
Over the <a href="http://web.archive.org/web/*/http://vg.no" onclick="javascript:pageTracker._trackPageview('/outbound/article/web.archive.org');">years</a> code has accumulated server initiated fetches. Stuff like  <code>file_get_content("http://somesite/someurl)</code> in the presentation code. This is bad since it creates external dependencies to deliver a page and keeps apache/nginx/lighttd threads/processes busy</p>
<p><code><br />
tshark  -i eth0 -n -aduration:60 -zhttp,tree -zhttp_srv,tree -T fields -e http.host -e http.request.uri -e http.request.method -R http -tad 'src host 10.0.0.144 and (dst port 80 or dst port 443)'<br />
</code></p>
<p>This roughly says: </p>
<ul>
<li>Listen on the eth0 interface for 60 seconds.</li>
<li>Write out two different sets of statistics about the traffic.</li>
<li>Write out the &#8220;Host:&#8221; header, the URL and the request method. (GET/POST).</li>
<li>Try to interpret the traffic as a HTTP.</li>
<li>write timestamps in a readable format (not used) </li>
<li>Only look at traffic <strong><em>from</em></strong> my IP to port 80 (HTTP) and port 443 (HTTPS)</li>
</ul>
<p>This little trick helped me identify loads of external dependencies and pinpointed some ugly code that needed some care.</p>
<p>And while I was at it. I figured out I could do something similar with mysql queries. Instead of turning on full Query-logging in mysql (which probably means a restart of a running production mysql) I could just sniff it</p>
<p><code><br />
tshark -i eth0 -aduration:60 -d tcp.port==3306,mysql -T fields -e mysql.query  'port 3306'<br />
</code></p>
<p>Which roughly says:</p>
<ul>
<li>Listen on eth0 for 60 seconds</li>
<li>Interpret port 3306 as mysql</li>
<li>write out queries</li>
<li>Only look at traffic on port 3306</li>
</ul>
<p>Have fun.</p>
<p>Other usefull options to -T fields -e<br />
http.response.code<br />
http.server<br />
http.content_type<br />
ip.src<br />
ip.dst<br />
tcp.port<br />
http.user_agent</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2009/03/tshark-to-the-rescue/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Years of Blogging</title>
		<link>http://audun.ytterdal.net/2008/10/10-years-of-blogging</link>
		<comments>http://audun.ytterdal.net/2008/10/10-years-of-blogging#comments</comments>
		<pubDate>Sat, 18 Oct 2008 19:41:21 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/?p=84</guid>
		<description><![CDATA[I&#8217;ve been blogging since 27 august 1998. Time to celebrate with.. yet another blogpost. During these 10 years on the internet I&#8217;ve written 47 blogposts. That averages to 4.7 posts a year. I&#8217;m pretty good. Since my last post, I&#8217;ve changed jobs (now working at VG Multimedia http://www.vg.no as head of IT Operations) , got [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been blogging since 27 august 1998. Time to celebrate with.. yet another blogpost. During these 10 years on the internet I&#8217;ve written 47 blogposts. That averages to 4.7 posts a year.</p>
<p>I&#8217;m pretty good. </p>
<p>Since my last post, I&#8217;ve changed jobs (now working at VG Multimedia <a href="http://www.vg.no" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.vg.no');">http://www.vg.no</a> as head of IT Operations) , got married (with Elisabeth) and got a daughter (Aurora, now 10 months).</p>
<p>The joy of the information society</p>
<p>I&#8217;ll keep you posted <img src='http://audun.ytterdal.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2008/10/10-years-of-blogging/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ok.We&#8217;re back</title>
		<link>http://audun.ytterdal.net/2006/12/okwere-back</link>
		<comments>http://audun.ytterdal.net/2006/12/okwere-back#comments</comments>
		<pubDate>Sat, 02 Dec 2006 18:19:28 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/12/02/okwere-back/</guid>
		<description><![CDATA[We are back home. And have been for a while. This is posted wirh my beloved E70]]></description>
			<content:encoded><![CDATA[<p>We are back home. And have been for a while. This is posted wirh my beloved E70</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/12/okwere-back/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving Towards Norway&#8230; Slowly&#8230;</title>
		<link>http://audun.ytterdal.net/2006/07/moving-towards-norway-slowly</link>
		<comments>http://audun.ytterdal.net/2006/07/moving-towards-norway-slowly#comments</comments>
		<pubDate>Wed, 19 Jul 2006 05:36:19 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/07/19/moving-towards-norway-slowly/</guid>
		<description><![CDATA[We have surfed Hawaii and went to a Katie Melua concert in Chicago and are now on our way to New York in a SUV. Right now in a Motel close to Woodstock. 24th july we&#8217;ll be landing in Oslo, Gardermoen.]]></description>
			<content:encoded><![CDATA[<p>We have surfed Hawaii and went to a Katie Melua concert in Chicago and are now on our way to New York in a SUV. Right now in a Motel close to Woodstock. 24th july we&#8217;ll be landing in Oslo, Gardermoen.</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/07/moving-towards-norway-slowly/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mr Lava Lava</title>
		<link>http://audun.ytterdal.net/2006/07/mr-lava-lava</link>
		<comments>http://audun.ytterdal.net/2006/07/mr-lava-lava#comments</comments>
		<pubDate>Sat, 08 Jul 2006 08:31:35 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/07/08/mr-lava-lava/</guid>
		<description><![CDATA[We have arrived Hawaii, and enjoyed a couple days in Honolulu and Waikiki Beach. The last two days we&#8217;ve spent on one of the other islands, the bigges one, the one that&#8217;s acctually called Hawai&#8217;i (or just&#8221;The Big Island&#8221;) and hiking to one of the worlds largest and most active volcanoes and walking a meter [...]]]></description>
			<content:encoded><![CDATA[<p>We have arrived Hawaii, and enjoyed a couple days in Honolulu and Waikiki Beach. The last two days we&#8217;ve spent on one of the other islands, the bigges one, the one that&#8217;s acctually called Hawai&#8217;i (or just&#8221;The Big Island&#8221;) and hiking to one of the worlds largest and most active volcanoes and walking a meter or two from flowing lava.. Exiting. Pictures will be up soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/07/mr-lava-lava/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leaving Australia</title>
		<link>http://audun.ytterdal.net/2006/07/leaving-australia</link>
		<comments>http://audun.ytterdal.net/2006/07/leaving-australia#comments</comments>
		<pubDate>Tue, 04 Jul 2006 08:00:24 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/07/04/leaving-australia/</guid>
		<description><![CDATA[We have completed all exams, we have celebrated, we have cried and we are now regretibly leaving Australia to return to our jobs back in Norway. We will miss our friends and aparment here. Hope you all come visit us in the future. Fortunatly we are making a detour through Hawaii, Chicago, New York and [...]]]></description>
			<content:encoded><![CDATA[<p>We have completed all exams, we have celebrated, we have cried and we are now regretibly leaving Australia to return to our jobs back in Norway.</p>
<p>We will miss our friends and aparment here. Hope you all come visit us in the future.</p>
<p>Fortunatly we are making a detour through Hawaii, Chicago, New York and London. Flying through USA gives us two pieces of 32kg luggage instead of one piece of  20kg, so &#8220;aloha&#8221;, here we go.</p>
<p>This is written in the airport in Sydney, waiting for our plane out of the country.</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/07/leaving-australia/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Music I Need To Have a Closer look at</title>
		<link>http://audun.ytterdal.net/2006/07/music-i-need-to-have-a-closer-look-at</link>
		<comments>http://audun.ytterdal.net/2006/07/music-i-need-to-have-a-closer-look-at#comments</comments>
		<pubDate>Sun, 02 Jul 2006 07:47:26 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/07/02/music-i-need-to-have-a-closer-look-at/</guid>
		<description><![CDATA[Japanese Visual Kai Japan X Dir en Grey Moi dix Mois Frensh Goth Eths]]></description>
			<content:encoded><![CDATA[<p><strong>Japanese Visual Kai </strong></p>
<p>Japan X</p>
<p>Dir en Grey</p>
<p>Moi dix Mois</p>
<p><strong>Frensh Goth </strong></p>
<p>Eths</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/07/music-i-need-to-have-a-closer-look-at/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>One Exam Left</title>
		<link>http://audun.ytterdal.net/2006/06/one-exam-left</link>
		<comments>http://audun.ytterdal.net/2006/06/one-exam-left#comments</comments>
		<pubDate>Sat, 24 Jun 2006 15:43:28 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/06/24/one-exam-left/</guid>
		<description><![CDATA[4 down, 1 to go. It&#8217;s the end of this semester and by the looks of it, I&#8217;ll be Master of Information Technology by tuesday. Since New Zeeland, which was this summer, autumn has passed and it&#8217;s now winter. We&#8217;ve did a short trip to Fiji which was pretty cool. Pictures are comming up. I [...]]]></description>
			<content:encoded><![CDATA[<p>4 down, 1 to go. It&#8217;s the end of this semester and by the looks of it, I&#8217;ll be Master of Information Technology by tuesday.</p>
<p>Since New Zeeland, which was this summer, autumn has passed and it&#8217;s now winter. We&#8217;ve did a short trip to Fiji which was pretty cool. Pictures are comming up.</p>
<p>I also modified the site slightly, now using the vslide theme for wordpress. It&#8217;s got this neat slideshow for a header and cool buttons to press to collapse postings.</p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/06/one-exam-left/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>In New Zealand</title>
		<link>http://audun.ytterdal.net/2006/02/in-new-zealand</link>
		<comments>http://audun.ytterdal.net/2006/02/in-new-zealand#comments</comments>
		<pubDate>Fri, 17 Feb 2006 06:04:55 +0000</pubDate>
		<dc:creator>ay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://audun.ytterdal.net/2006/02/17/in-new-zealand/</guid>
		<description><![CDATA[Elisabeth and me are currently spending our &#8220;summer&#8221; holydays in New Zealand. We started in Auckland, been working our way down to the south island and are now in Queenstown, the &#8220;action capital&#8221;. We have been skydiving in Taupo, diving in the Fjords and tomorrow we are going to do three bungy jump from 43m, [...]]]></description>
			<content:encoded><![CDATA[<p>Elisabeth and me are currently spending our &#8220;summer&#8221; holydays in New Zealand.<br />
We started in Auckland, been working our way down to the south island and are now in Queenstown, the &#8220;action capital&#8221;.</p>
<p>We have been skydiving in Taupo, diving in the Fjords and tomorrow we are going to do three bungy jump from 43m, 110m and 134m meters. </p>
<p>Later. </p>
]]></content:encoded>
			<wfw:commentRss>http://audun.ytterdal.net/2006/02/in-new-zealand/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
