<?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"
	>

<channel>
	<title>Greg needs your input</title>
	<atom:link href="http://blogs.splunk.com/greg/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.splunk.com/greg</link>
	<description>If it goes in our out of Splunk, I've tested it.</description>
	<pubDate>Tue, 04 Aug 2009 23:29:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>40 Days of 4.0: How to consume tcptrace with Splunk 4.0</title>
		<link>http://blogs.splunk.com/greg/how-to-consume-tcptrace-with-splunk-40/</link>
		<comments>http://blogs.splunk.com/greg/how-to-consume-tcptrace-with-splunk-40/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 21:59:40 +0000</pubDate>
		<dc:creator>greg</dc:creator>
		
		<category><![CDATA[40 days of Splunk 4.0]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/greg/?p=3</guid>
		<description><![CDATA[The idea to consume tcptrace with Splunk came to me after seeing Darren Hoch&#8217;s OSCON 2009 presentation Linux System and Network Performance Monitoring. In his talk Darren shows how he diagnosed home networking issues using tcptrace. Here&#8217;s his description of tcptrace:
The tcptrace utility provides detailed TCP based information about specific
connections. The utility uses libpcap based [...]]]></description>
			<content:encoded><![CDATA[<p>The idea to consume tcptrace with Splunk came to me after seeing <a href="http://ufsdump.org/">Darren Hoch</a>&#8217;s <a href="http://en.oreilly.com/oscon2009/public/schedule/detail/7519">OSCON 2009</a> presentation <a href="http://ufsdump.org/papers/oscon2009-linux-monitoring.pdf"><em>Linux System and Network Performance Monitoring</em></a>. In his talk Darren shows how he diagnosed home networking issues using <a href="http://jarok.cs.ohiou.edu/software/tcptrace/">tcptrace</a>. Here&#8217;s his description of tcptrace:</p>
<blockquote><p>The tcptrace utility provides detailed TCP based information about specific<br />
connections. The utility uses libpcap based files to perform an analysis of<br />
specific TCP sessions. The utility provides information that is sometimes difficult<br />
to catch in a TCP stream. This information includes:<br />
• TCP Retransmissions – the amount of packets that needed to<br />
be sent again and the total data size<br />
• TCP Window Sizes – identify slow connections with small<br />
window sizes<br />
• Total throughput of the connection<br />
• Connection duration</p></blockquote>
<p>The data coming out of tcptrace looks like this:</p>
<pre>TCP connection 1:
        host a:        gba-ubun810-amd64.splunk.com:40739
        host b:        spreader.yandex.net:80
        complete conn: no       (SYNs: 0)  (FINs: 0)
        first packet:  Wed Jul 22 19:58:34.489567 2009
        last packet:   Wed Jul 22 19:58:35.164233 2009
        elapsed time:  0:00:00.674666
        total packets: 395
        filename:      testdump1000
   a-&gt;b:                              b-&gt;a:
     total packets:           147           total packets:           248
     ack pkts sent:           147           ack pkts sent:           248
&lt;snip&gt;</pre>
<p>Complex? Yes. Edible by Splunk? Hell yes.</p>
<p><span id="more-3"></span></p>
<h2>The prerequisites for this setup are:</h2>
<ol>
<li>Splunk 4.0 installed on your system. <a href="http://www.splunk.com/download">Download Splunk 4.0 Free</a></li>
<li>tcpdump installed on your system. Included with most *nix based operating systems or available at <a href="http://www.tcpdump.org/">http://www.tcpdump.org/</a></li>
<li>tcptrace installed on your system. Available at <a href="http://jarok.cs.ohiou.edu/software/tcptrace/">http://jarok.cs.ohiou.edu/software/tcptrace/</a></li>
<li>super-user (root) access to your system, or ability execute tcpdump via sudo</li>
</ol>
<h2>An outline of the steps we&#8217;re going to take:</h2>
<ol>
<li>Capture some data with tcpdump and parse the data with tcptrace</li>
<li>Configure splunk to read the parsed data from tcptrace</li>
<li>Use splunk to extract useful data from tcptrace</li>
<li>Use splunk to graph data from tcptrace</li>
</ol>
<h2>Step 1: Capture some data with tcpdump and parse the data with tcptrace</h2>
<p>Capture data with tcpdump:</p>
<pre class="brush: bash">$ sudo tcpdump -nevvs 1520 -C 10 -w /tmp/tcp.dump</pre>
<p>Parse the data with tcptrace:</p>
<pre class="brush: bash">$ tcptrace -l tcp.dump &gt; /tmp/tcptrace.log</pre>
<h2>Step 2: Configure splunk to read parsed data from tcptrace</h2>
<p>Add these lines to your <strong>$SPLUNK_HOME/etc/system/local/inputs.conf</strong></p>
<pre class="brush: xml">
[monitor:///tmp/tcptrace.log]
sourcetype = tcptrace
</pre>
<p>Add these lines to your <strong>$SPLUNK_HOME/etc/system/local/props.conf</strong></p>
<pre class="brush: xml">
[tcptrace]
TIME_PREFIX = \s+last\s+packet:\s+
BREAK_ONLY_BEFORE = TCP\ connection\ \d+:
REPORT-tcptrace = tcptrace-rexmts
TRANSFORMS = tcptrace-hosts
</pre>
<p>Add these lines to your <strong>$SPLUNK_HOME/etc/system/local/transforms.conf</strong></p>
<pre class="brush: xml">
[tcptrace-hosts]
REGEX = (?m)\s+host\s+\w+:\s+(?[^\r\n]*)[\r\n]\s+host\s+\w+:\s+(?[^\r\n]*)[\r\n]
FORMAT = host1::&quot;$1&quot; host2::&quot;$2&quot;
WRITE_META = true
[tcptrace-rexmts]
REGEX = \s+rexmt data pkts:\s+(?[^\r\n]\d+)\s+rexmt data pkts:\s+(?[^\r\n]\d+)
FORMAT = host1_rexmt_data_pkts::&quot;$1&quot; host2_rexmt_data_pkts::&quot;$2&quot;
</pre>
<p>Add these lines to your <strong>$SPLUNK_HOME/etc/system/local/fields.conf</strong></p>
<pre class="brush: xml">
[host1]
INDEXED = true
[host2]
INDEXED = true
</pre>
<p>Once you&#8217;ve updated your splunk system configs restart Splunk:</p>
<pre class="brush: bash">$SPLUNK_HOME/bin/splunk restart</pre>
<h2>Step 3: Use splunk to extract useful data from tcptrace</h2>
<p>Log into your splunk instance and execute this search to see a timeline of most frequent packet retransmissions:<br />
<code>sourcetype="tcptrace" | search host1_rexmt_data_pkts&gt;0 OR host2_rexmt_data_pkts&gt;0</code><br />
<a href="http://undef.wordpress.com/files/2009/07/timeline_count_rexmt.png"><img class="alignnone size-medium wp-image-301" title="Timeline Count of Events" src="http://undef.wordpress.com/files/2009/07/timeline_count_rexmt.png" alt="timeline_count_rexmt" width="689" height="101" /></a></p>
<p>Perhaps you&#8217;d like to know which connections are retransmitting packets? Add the following modifier to your search string <code>| fields host1,host2,host1_rexmt_data_pkts,host2_remxt_data_pkts</code> so that it reads:<br />
<code>sourcetype="tcptrace" | search host1_rexmt_data_pkts&gt;0 OR host2_rexmt_data_pkts&gt;0 | fields host1,host2,host1_rexmt_data_pkts,host2_remxt_data_pkts</code><br />
Execute your search, but this time click the <strong>Events Table</strong> button <img class="alignnone size-full wp-image-303" title="events_table_button" src="http://undef.wordpress.com/files/2009/07/events_table_button.png" alt="events_table_button" width="69" height="30" />.</p>
<p>Want to see something cooler? Try selecting the <strong>Heat Map</strong> <strong>Overlay:</strong></p>
<p><strong><a href="http://undef.wordpress.com/files/2009/07/heatmap_overlay.png"><img class="alignnone size-full wp-image-305" title="heatmap_overlay" src="http://undef.wordpress.com/files/2009/07/heatmap_overlay.png" alt="heatmap_overlay" width="566" height="98" /></a><br />
</strong></p>
<h2>Step 4: Use splunk to graph data from tcptrace</h2>
<p>To get a useful graph out of splunk update your search string to read:<br />
<code> sourcetype="tcptrace" | search host1_rexmt_data_pkts&gt;0 OR host2_rexmt_data_pkts&gt;0 | timechart max(host1_rexmt_data_pkts),max(host2_rexmt_data_pkts) | fillnull value=0 | rename max(host1_rexmt_data_pkts) as "Packet Retransmits from me",max(host2_rexmt_data_pkts) as "Packet Retransmits to me"</code><br />
Then click on the <strong>Show Report</strong> button <img class="alignnone size-full wp-image-308" title="show_report_button" src="http://undef.wordpress.com/files/2009/07/show_report_button.png" alt="show_report_button" width="89" height="24" />. Once you&#8217;re in the report builder for <strong>Chart Type</strong> select <strong>area</strong> and click <strong>Apply</strong>:<br />
<a href="http://www.splunk.com/base/images/9/97/Charts_-_area.png"><img class="alignnone" title="Packet Retransmissions Across Time" src="http://www.splunk.com/base/images/9/97/Charts_-_area.png" alt="" width="566" height="193" /></a></p>
<p>That&#8217;s it for now. Next time I&#8217;ll show you how to make a dashboard that you can share with other splunk users in your organization.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/greg/how-to-consume-tcptrace-with-splunk-40/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eating NetFlow with Splunk, Part 1</title>
		<link>http://blogs.splunk.com/greg/eating-netflow-with-splunk-part-1/</link>
		<comments>http://blogs.splunk.com/greg/eating-netflow-with-splunk-part-1/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 23:42:43 +0000</pubDate>
		<dc:creator>greg</dc:creator>
		
		<guid isPermaLink="false">http://blogs.splunk.com/greg/?p=1</guid>
		<description><![CDATA[It&#8217;s easy to eat network data using Splunk. In a recent seminar I demonstrated how quickly a network administrator could dig through NetFlow data to diagnose network problems using Splunk. Here I&#8217;ll show you some steps for getting NetFlow (cflow, jflow, netstream, IPFIX, sflow) data into Splunk.

For this setup we&#8217;ll need the following:

A Splunk installation [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easy to eat network data using Splunk. In a recent seminar I demonstrated how quickly a network administrator could dig through NetFlow data to diagnose network problems using Splunk. Here I&#8217;ll show you some steps for getting <a href="http://en.wikipedia.org/wiki/Netflow">NetFlow</a> (cflow, jflow, netstream, IPFIX, sflow) data into Splunk.</p>
<p><span id="more-1"></span></p>
<p>For this setup we&#8217;ll need the following:</p>
<ol>
<li>A Splunk installation on a *nix platform. You can <a href="http://www.splunk.com/download">download Splunk here</a>.<a href="http://www.splunk.com/download"></a></li>
<li><a href="http://www.splintered.net/sw/flow-tools/">flow-tools.</a></li>
<li>DJB&#8217;s <a href="http://cr.yp.to/daemontools.html">daemontools</a>.</li>
<li>A NetFlow source. This can be a Cisco or Juniper router, or a system running <a href="http://www.ntop.org/nProbe.html">nProbe</a>.</li>
</ol>
<p>Here are the detailed steps for setting up Splunk + NetFlow:</p>
<p><strong>Please note:</strong></p>
<ul>
<li>In these examples we&#8217;re using FreeBSD 6.3 amd64, the commands shown may vary on your system.</li>
<li>Before running these commands make sure you&#8217;ve <strong>su</strong>&#8216;d to <strong>root</strong>.</li>
</ul>
<p><strong>1.</strong> Download &amp; Install Splunk, flow-tools &amp; daemontools:</p>
<pre># pkg_add "http://tinyurl.com/splunk3-4-fbsd63-amd64"
# portinstall flow-tools
# portinstall daemontools
</pre>
<p><strong>2.</strong> Configure flow-tools &amp; daemontools:</p>
<pre># mkdir -p /var/service/flow-receive
# cat &gt;/var/service/flow-receive/run&lt;&lt;EOF
#!/bin/sh
export FLOW_PIPE="/var/run/flow.pipe"
if [ ! -p "\$FLOW_PIPE" ]; then
mkfifo &#8220;\$FLOW_PIPE&#8221;
fi
/usr/local/bin/flow-receive 0/0/9800 | /usr/local/bin/flow-print -f 5 &gt; \$FLOW_PIPE
EOF
# chmod +x /var/service/flow-receive/run
# echo &#8220;svcscan_enable=YES&#8221;&gt;&gt;/etc/rc.conf
# /usr/local/src/rc.d/svscan.sh start
# ln -s /var/service/flow-receive /service</pre>
<p><strong>3.</strong> Configure Splunk:</p>
<pre># echo &gt;&gt;/opt/splunk/etc/system/local/inputs.conf&lt;&lt;EOF
[fifo:///var/run/flow.pipe]
disabled = false
sourcetype = netflow
EOF
# echo &gt;&gt;/opt/splunk/etc/system/local/props.conf&lt;&lt;EOF
[netflow]
AUTO_LINEMERGE = false
SHOULD_LINEMERGE = false
EOF
# /opt/splunk/bin/splunk restart</pre>
<p>Now we&#8217;re ready to start eating NetFlow data. In Part 2 I&#8217;ll show you how to configure your network equipment to send this data, and some ways you can use this data within Splunk.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/greg/eating-netflow-with-splunk-part-1/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
