<?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>kordless</title>
	<atom:link href="http://blogs.splunk.com/kordless/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.splunk.com/kordless</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Thu, 19 Jun 2008 19:47:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>You want a platform?  We got your platform right here, buddy.</title>
		<link>http://blogs.splunk.com/kordless/2008/02/22/you-want-a-platform-we-got-your-platform-right-here-buddy/</link>
		<comments>http://blogs.splunk.com/kordless/2008/02/22/you-want-a-platform-we-got-your-platform-right-here-buddy/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 23:35:35 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2008/02/22/you-want-a-platform-we-got-your-platform-right-here-buddy/</guid>
		<description><![CDATA[There has been a lot of talk about the Splunk Platform of late, but what exactly does it mean when we say we have a platform?  I figured this would be an interesting question to spring upon unsuspecting members of the development team, and here's what they (and I) had for our answers:

[qt:/wp-content/uploads/2008/02/splunk_as_platform_large.mov /wp-content/uploads/2008/02/what_is_poster.mov 625 368]

Browsing over on Wikipedia, <a href="http://en.wikipedia.org/wiki/Platform_%28computing%29">one excerpt</a> states that <em>"a platform describes some sort of hardware architecture or software framework"</em>, and the description for a <a href="http://en.wikipedia.org/wiki/Software_framework">software framework</a>, says it <em>"may include support programs, code libraries, a scripting language, or other software to help develop and glue together the different components of a software project"</em>.]]></description>
			<content:encoded><![CDATA[<p>There has been a lot of talk about the Splunk Platform of late, but what exactly does it mean when we say we have a platform?  I figured this would be an interesting question to spring upon unsuspecting members of the development team, and here&#8217;s what they (and I) had for our answers:</p>
<div id="vvq4b07eb83e6796" class="vvqbox vvqquicktime" style="width:400px;height:300px;"><a href="http://blogs.splunk.com/devuploads/2008/02/splunk_as_platform_large.mov">http://blogs.splunk.com/devuploads/2008/02/splunk_as_platform_large.mov</a></div>
<p>Browsing over on Wikipedia, <a href="http://en.wikipedia.org/wiki/Platform_%28computing%29">one excerpt</a> states that <em>&#8220;a platform describes some sort of hardware architecture or software framework&#8221;</em>, and the description for a <a href="http://en.wikipedia.org/wiki/Software_framework">software framework</a>, says it <em>&#8220;may include support programs, code libraries, a scripting language, or other software to help develop and glue together the different components of a software project&#8221;</em>.</p>
<p>A platform can be considered as a type of framework - one which helps developers write software faster by a) giving them the tools to develop against it, and b) transparently dealing with the under-the-hood, nitty-gritty work necessary when dealing with difficult problems.  Difficult problems like indexing and searching gigabytes upon gigabytes of event data, for example.</p>
<p>Well, that&#8217;s exactly what the Splunk Platform does for developers.  It provides resources, examples, and SDKs for developing a variety of applications around the robust Splunk engine, and it provides a launching point for domain specific development, from availability and security, to business intelligence and compliance.</p>
<p>BTW, this isn&#8217;t something we&#8217;re just waving our hands around about and saying &#8220;look at this white paper, isn&#8217;t this a nice idea?&#8221;.  Nope.  Platform is here, and it&#8217;s here today, with links to real code, real content, and real resources for the developers looking to write the next great idea.</p>
<p>Here&#8217;s how to get started writing your first application against the Splunk Platform:</p>
<ol>
<li>1. <a href="http://www.splunk.com/index.php/preview">Download a Preview</a> of Splunk that has a brand new shiny REST-based API built into it.</li>
<li>2. Head on over to the <a href="http://code.google.com/p/splunk-labs/">developer&#8217;s wiki</a> and start digging around in the API howtos.</li>
<li>4. Download the new <a href="http://code.google.com/p/splunk-net-sdk/">.NET SDK</a> from its Google Code project page.</li>
<li>4. Join the any of the projects and start contributing code/content.</li>
<li>5. Join the new <a href="http://groups.google.com/group/splunk-labs">Splunk Labs</a> list and start interacting (asynchronously) with our developers.</li>
<li>6. Hop on #splunk on IRC and chat with us in real time.</li>
</ol>
<p>We&#8217;ll be continuing to add content and resources to the Platform effort, and we encourage your participation in the development community as it forms.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2008/02/22/you-want-a-platform-we-got-your-platform-right-here-buddy/feed/</wfw:commentRss>
<enclosure url="http://dev.splunk.com/wp-content/uploads/2008/02/what_is_poster.mov" length="23100" type="video/quicktime" />
<enclosure url="http://blogs.splunk.com/devuploads/2008/02/splunk_as_platform_large.mov" length="8462745" type="video/quicktime" />
		</item>
		<item>
		<title>Gem Noticed by Enterprise Networking Planet</title>
		<link>http://blogs.splunk.com/kordless/2008/01/24/noticed-by-enterprise-networking-planet/</link>
		<comments>http://blogs.splunk.com/kordless/2008/01/24/noticed-by-enterprise-networking-planet/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 01:48:53 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2008/01/24/noticed-by-enterprise-networking-planet/</guid>
		<description><![CDATA[I have a Google alert set up to email me news of the extraordinary concerning Splunk.  Most of them are press releases by either us or our agency, which are all well and fine (this is how most companies seed stories anyway), but one caught my eye this morning by Charlie Schluting over on [...]]]></description>
			<content:encoded><![CDATA[<p>I have a Google alert set up to email me news of the extraordinary concerning Splunk.  Most of them are press releases by either us or our agency, which are all well and fine (this is how most companies seed stories anyway), but <a href="http://www.enterprisenetworkingplanet.com/netos/article.php/3723406">one caught my eye</a> this morning by Charlie Schluting over on <a href="http://enterprisenetworkingplanet.com">Enterprise Networking Planet</a>.</p>
<p>Two things struck me interesting about Charlie&#8217;s post.  </p>
<p>First, he noticed the changes in the UI we&#8217;ve been slowly making over the last few releases.  If you&#8217;ve ever done UI design, you know how much sweat goes into every little detail, and how much momentum a design carries over time.  That someone noticed the new changes *and* liked them is a HUGE win for the UI team.  It&#8217;s even better how fast someone noticed!</p>
<p>Second, he actually spends quite a bit of time explaining the security workaround in the free product - <a href="http://dev.splunk.com/2008/01/14/splunk-hack-4-aliasing-splunk-with-a-subdomain/">one that I covered</a> earlier, coincidently enough.  I figure if someone goes to the time and trouble to figure out how they can keep using the product in a secure, legitimate way, then they must really, really like it.  You simply can&#8217;t argue with an evangelist like this.</p>
<p>If anyone here is a gem, it&#8217;s Charlie.</p>
<p><img src='http://blogs.splunk.com/devuploads/2008/01/insight_jun04_mailbox_kohinoor_large.jpg' alt='insight_jun04_mailbox_kohinoor_large.jpg' /></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2008/01/24/noticed-by-enterprise-networking-planet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Splunk Hack #4 - Aliasing Splunk with a Subdomain</title>
		<link>http://blogs.splunk.com/kordless/2008/01/14/splunk-hack-4-aliasing-splunk-with-a-subdomain/</link>
		<comments>http://blogs.splunk.com/kordless/2008/01/14/splunk-hack-4-aliasing-splunk-with-a-subdomain/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 18:14:02 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[hacks]]></category>

		<category><![CDATA[preview]]></category>

		<category><![CDATA[tech]]></category>

		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2008/01/14/splunk-hack-4-aliasing-splunk-with-a-subdomain/</guid>
		<description><![CDATA[With the new release of <a href="http://www.splunk.com/index.php/preview/20071229">Splunk Preview</a> out, I've run into a problem keeping the different versions straight on my laptop.  I have the free version, the Preview, the official release, <b>and</b> a version of current running - often times simultaneously.  It's getting messy.

What you really want to do is refer to them with different subdomain names, where something like <font color="#A8C479"><i>http://splunkpreview.mydomain.com/</i></font> would bring up Splunk without having to remember the port number.

If you are running Apache, (like I am on Leopard) you get a reverse proxy server for free.  With just a few lines of configuration, you can alias subdomains (or domains for that matter) to your heart's content.

You also get the ability of putting content behind some basic authentication provided via Apache's HTTP auth methods.  This comes in handy if you'd like to link to your Splunk install from a publicly facing page, but don't want people to know what type of content is behind the authentication.  It also works for limiting access to a particular IP address group or domain.

I've put together a screencast covering how to do this from OS X's version of Apache.  Click on the thumbnail below to play the screencast.

<a href='http://dev.splunk.com/wp-content/uploads/2008/01/kord_proxy_large_out.mov' title='Alilasing Splunk'><img width=528px height=297px  src="http://dev.splunk.com/wp-content/uploads/2008/01/kord_proxy_large_out1.jpg"></a>
]]></description>
			<content:encoded><![CDATA[<p>With the new release of <a href="http://www.splunk.com/index.php/preview/20071229">Splunk Preview</a> out, I&#8217;ve run into a problem keeping the different versions straight on my laptop.  I have the free version, the Preview, the official release, <b>and</b> a version of current running - often times simultaneously.  It&#8217;s getting messy.</p>
<p>What you really want to do is refer to them with different subdomain names, where something like <font color="#A8C479"><i>http://splunkpreview.mydomain.com/</i></font> would bring up Splunk without having to remember the port number.</p>
<p>If you are running Apache, (like I am on Leopard) you get a reverse proxy server for free.  With just a few lines of configuration, you can alias subdomains (or domains for that matter) to your heart&#8217;s content.</p>
<p>You also get the ability of putting content behind some basic authentication provided via Apache&#8217;s HTTP auth methods.  This comes in handy if you&#8217;d like to link to your Splunk install from a publicly facing page, but don&#8217;t want people to know what type of content is behind the authentication.  It also works for limiting access to a particular IP address group or domain.</p>
<p>I&#8217;ve put together a screencast covering how to do this from OS X&#8217;s version of Apache.  Click on the thumbnail below to play the screencast.</p>
<p><a href='http://blogs.splunk.com/devuploads/2008/01/kord_proxy_large_out.mov' title='Alilasing Splunk'><img width=528px height=297px  src="http://blogs.splunk.com/devuploads/2008/01/kord_proxy_large_out1.jpg"></a></p>
<p><b>Note</b>:  Firewalling the actual port Splunk runs on is left as an exercise for the viewer, as is limiting access to a group of IP addresses.  More information about configuring Apache&#8217;s <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html">mod_proxy module</a> can be found on <a href="http://httpd.apache.org/">Apache&#8217;s website</a>.</p>
<p>Here&#8217;s the configuration code from the screencast:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>VirtualHost <span class="sy0">*:</span><span class="nu0">80</span><span class="sy0">&gt;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ServerName preview<span class="sy0">.</span>geekceo<span class="sy0">.</span>com </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&lt;</span>Location <span class="sy0">/&gt;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ProxyPass http<span class="sy0">:</span><span class="co1">//localhost:8000/ </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ProxyPassReverse http<span class="sy0">:</span><span class="co1">//localhost:8000/ </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&lt;/</span>Location<span class="sy0">&gt;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>VirtualHost<span class="sy0">&gt;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>VirtualHost <span class="sy0">*:</span><span class="nu0">80</span><span class="sy0">&gt;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ServerName free<span class="sy0">.</span>geekceo<span class="sy0">.</span>com </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&lt;</span>Location <span class="sy0">/&gt;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ProxyPass http<span class="sy0">:</span><span class="co1">//localhost:8001/ </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ProxyPassReverse http<span class="sy0">:</span><span class="co1">//localhost:8001/ </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; AuthType Basic </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; AuthName <span class="st0">&quot;Password Required&quot;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; AuthUserFile <span class="sy0">/</span>etc<span class="sy0">/.</span>htpasswd </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">require</span> valid<span class="sy0">-</span>user </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&lt;/</span>Location<span class="sy0">&gt;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;/</span>VirtualHost<span class="sy0">&gt;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2008/01/14/splunk-hack-4-aliasing-splunk-with-a-subdomain/feed/</wfw:commentRss>
<enclosure url="http://dev.splunk.com/wp-content/uploads/2008/01/kord_proxy_large_out.mov" length="30054986" type="video/quicktime" />
<enclosure url="http://blogs.splunk.com/devuploads/2008/01/kord_proxy_large_out.mov" length="30054986" type="video/quicktime" />
		</item>
		<item>
		<title>Splunk Hack #3 - Splunk on Rails</title>
		<link>http://blogs.splunk.com/kordless/2007/11/02/splunk-hack-3-splunk-on-rails/</link>
		<comments>http://blogs.splunk.com/kordless/2007/11/02/splunk-hack-3-splunk-on-rails/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 01:09:08 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2007/11/02/splunk-hack-3-splunk-on-rails/</guid>
		<description><![CDATA[Ruby on Rails is a popular programming framework for quickly creating web applications.  It provides its own web server for development testing, and ships with OSX, which means the tools are now widely available to a broad group of programmers/coders/hackers.  Coupled with the fact that most Rails developers use either Linux or OSX, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rubyonrails.com/">Ruby on Rails</a> is a popular programming framework for quickly creating web applications.  It provides its own web server for development testing, and ships with OSX, which means the tools are now widely available to a broad group of programmers/coders/hackers.  Coupled with the fact that most Rails developers use either Linux or OSX, and Splunk runs great on both of those platforms, it seemed obvious that we should come up with some sort of solution for mashing the two together.</p>
<p>I mentioned this in passing to one <a href="http://seandick.com/">Sean Dick</a> who is a developer friend of mine in Oklahoma City.  What follows is a nearly identical post to the one he made over at his <a href="http://seanmdick.blogspot.com">self-named blogpost</a> on Blogger on how to get Rails to integrate with Splunk.  &#8220;There&#8217;s plenty left to do.&#8221;, he said, but I&#8217;m convinced it&#8217;s worthy of mentioning here.  Thanks for hammering this out Sean!</p>
<p><b>Serious Material from Sean Begins Here</b></p>
<p>As per the norm, this post assumes you&#8217;ve <a href="http://www.splunk.com/download/?ac=kc3">downloaded Splunk</a> for your particular platform.  It also requires a newer install of <a href="http://www.rubyonrails.com/">Ruby on Rails</a>.  Come back when you&#8217;ve completed both these tasks.</p>
<p>Get Splunk started now:<br />
<code><br />
> sudo export SPLUNK_HOME=/opt/splunk/<br />
> sudo ./opt/splunk/bin/splunk start<br />
</code></p>
<p>You need to drop the <a href="http://blogs.splunk.com/devuploads/2007/11/splunkonrails.rb.zip">Splunk on Rails plugin</a> into your Rails app&#8217;s lib folder and then call it with <strong>require &#8217;splunkbase&#8217;</strong>  Note: If you&#8217;re running Splunk remote or on a non-standard port, don&#8217;t forget to change the SERVER variable in the plugin file!</p>
<p>Now let&#8217;s say you want to make sure your rails application is running bug-free, and when one does pop up, you need to know it pronto.  You&#8217;ll create a new controller into which we&#8217;re going to put some splunk goodies. I named mine SplunkController, but you can be more creative.</p>
<p><code><br />
class SplunkController &lt; ApplicationController<br />
require 'splunkbase'<br />
@@foo = SplunkBase.new<br />
def index<br />
end<br />
def reports<br />
  @document =" @@foo.splunkSearch('q' => params[:query])<br />
end<br />
end<br />
</code></p>
<p>This is really nothing more than making available the response from splunk to your view in the form of a variable. Defining a page for it to be displayed in is no more difficult than:<br />
<code><br />
&lt;pre&gt;&lt;%= @document %&gt; &lt;/pre&gt;<br />
</code></p>
<p>Now we build the index page we defined so we can pass it the query:<br />
<code><br />
&lt;html><br />
   &lt;head><br />
        &lt;%= javascript_include_tag "prototype" %><br />
   &lt;/head><br />
   &lt;body ><br />
        &lt;%= form_remote_tag(:update => "graphDiv",<br />
                    :url => {:action => :reports }) %><br />
             &lt;%= text_field_tag :query, nil, {:size => "100"} %></p>
<p>             &lt;%= submit_tag "Get a report on your query" %><br />
        &lt;%= end_form_tag %><br />
        &lt;div id="graphDiv"><br />
        &lt;/div><br />
   &lt;/body><br />
&lt;/html><br />
</code></p>
<p>And believe it or not we&#8217;re ready to start asking Splunk some questions. Try giving it something like:<br />
<code><br />
[search sourcetype::what_you_named_your_source error starthoursago=24] | outputxml<br />
</code></p>
<p>As you&#8217;ve probably gathered, that&#8217;ll give you a formatted list of all of the errors that have occurred in the last day.</p>
<p>Now let&#8217;s say you&#8217;ve got a rails application running internally that you don&#8217;t have the option to/don&#8217;t feel comfortable with outsource analysis to something like Google Analytics.  Back to our cute little controller, we add in a new definition for the graphing page.<br />
<code><br />
class SplunkController &lt; ApplicationController<br />
 require 'splunkbase' #those two magical words<br />
 @@foo = SplunkBase.new<br />
 def index<br />
 end<br />
 def reports<br />
   @document = @@foo.splunkSearch('q' => params[:query])<br />
 end<br />
 def graph #for graphing, this fixes things up so we can display the data<br />
  @datahash = {}     @queryDoc= @@foo.splunkSearch(&#8217;q&#8217; => params[:query]) #here is the meat<br />
  @queryDoc.each_element(&#8221;//r/&#8221;) do |ele| #here we&#8217;re sorting out what is useful<br />
    @datahash[ele.elements["m[@col='1']&#8220;].text] = ele.elements["m[@col='2']&#8220;].text.to_i<br />
  end<br />
  @sorted = @datahash.values.sort.reverse  #sorting it for the hell of it<br />
  @chartheight = @datahash.values.max + 50 #to make it look pretty and consistent<br />
end<br />
end<br />
</code></p>
<p>This example is fairly simple and assumes you&#8217;re just looking for basic metrics on your site&#8217;s usage. You could build it larger to accept whatever you want splunk to throw back at you. This one expects to see something like <code>"Content Name" => "value"</code>.</p>
<p>Now let&#8217;s take a stab at setting up the graph:</p>
<p><code><br />
  &lt;samp>&lt;%= @queryDoc.to_s %>&lt;/samp> #gives us a raw return of the data we pulled from Splunk<br />
&lt;/div><br />
&lt;% @sorted.each do |name, height| %> #Iterate through each of the data pairs and grab the height.<br />
  &lt;div class="columnSpacer"><br />
      &lt;div style="margin-top: &lt;%= 100 - ((height * 100)/@chartheight.to_f) %>%"class="graphTitle"><br />
          &lt;%= name %><br />
          &lt;br><br />
          &lt;%= height %> hits<br />
      &lt;/div><br />
      &lt;div class="graphColumn" style="height: &lt;%= (height * 100)/@chartheight.to_f)%>%"></p>
<p>  &lt;/div><br />
&lt;% end %><br />
</code></p>
<p>In the interest of keeping things from getting too esoteric I&#8217;ve committed a no-no and left some programming in the view. All in all, it&#8217;s pretty light math to get things displaying properly. As you should be able to glean from the code presented we&#8217;re just iterating through each of the name/value pairs we extracted from the XML Splunk returned and turning them into pretty little bars on a chart. Now all we need to do is put together the index page for accessing the graph function.</p>
<p><code><br />
&lt;html><br />
   &lt;head><br />
        &lt;%= javascript_include_tag "prototype" %><br />
   &lt;/head><br />
   &lt;body ><br />
        &lt;%= form_remote_tag(:update => "graphDiv",<br />
                    :url => {:action => :graph }) %><br />
             &lt;%= text_field_tag :query, nil, {:size => "100"} %></p>
<p>             &lt;%= submit_tag "Get a report on your query" %><br />
        &lt;%= end_form_tag %><br />
        &lt;div id="graphDiv"><br />
        &lt;/div><br />
   &lt;/body><br />
&lt;/html><br />
</code></p>
<p>There&#8217;s pretty minimal monkey business here, so let&#8217;s go on to the fun part:</p>
<p>Let&#8217;s take a look at what controllers are getting the most face-time for our users and what content sections are being perceived as being the most useful. This example comes from a site I did recently for a client and happens to be the most handy rails logfile I have within reach.</p>
<p>Pop in the query:<br />
<code><br />
[search sourcetype="the_name_you_gave_your_source" | top 5 controller ] | outputxml<br />
</code></p>
<p>And you get something like this:</p>
<p><img src="http://blogs.splunk.com/devuploads/2007/11/controllerchart.png"/></p>
<p>There are a myriad of options available to you through Splunk&#8217;s search interface, and learning to romance the queries to give you what you want would be a section all its own. This one, however consists of limiting the scope of the search ( sourcetype= ) and giving it a context to put it in ( top 5 controller ) &#8212; in this case, the top five controllers.</p>
<p>Next post I will cover the possibilities afforded with the use of bundles in Splunk in conjunction with your Rails application. In the meantime I highly suggest you peruse the REST API documentation supplied in your Splunk install and the admin/developer documentation on Splunk.com to get a more in-depth understanding of what you can do.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2007/11/02/splunk-hack-3-splunk-on-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Splunk Hack #2 - Logging Safari Requests on the iPhone</title>
		<link>http://blogs.splunk.com/kordless/2007/10/10/splunk-hack-2-logging-safari-requests-on-the-iphone/</link>
		<comments>http://blogs.splunk.com/kordless/2007/10/10/splunk-hack-2-logging-safari-requests-on-the-iphone/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 05:50:56 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2007/10/10/splunk-hack-2-logging-safari-requests-on-the-iphone/</guid>
		<description><![CDATA[Mark Cohen posted a while back about enabling syslog on the iPhone for the sole purpose of logging to a Splunk instance on your laptop.  This hack is a follow up to that post, and extends it slightly to include logging of the pages browsed by Safari on the phone.  WARNING: If you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dev.splunk.com/author/mark/">Mark Cohen</a> posted a while back about <a href="http://dev.splunk.com/2007/08/26/splunking-your-iphone/">enabling syslog on the iPhone</a> for the sole purpose of logging to a Splunk instance on your laptop.  This hack is a follow up to that post, and extends it slightly to include logging of the pages browsed by Safari on the phone.  WARNING: If you brick your phone, you can still use it as an ergonomic pot-scraper.  Splunk won&#8217;t be responsible for you going off and getting your <del>$600</del> $400 piece of joy stuffed, but we&#8217;ll be happy to log the event.</p>
<p>Let&#8217;s get dirty.  Go into settings..general..auto-lock and set locking to &#8216;never&#8217;.  This will keep the phone on while you hack around on it.   Keeping the phone on and connected to the network will drain your battery like nobody&#8217;s business, so make sure you plug in the charging cable.</p>
<p>Now install <a href="http://iphone.nullriver.com/beta/">AppTap</a>.  Follow the instructions, and come back here when you are all done.</p>
<p>Using the AppTap installer on the phone, install the Community Sources, BSD Subsystem, Term-vt100, OpenSSH, Tinyproxy, and UIctl apps, in that order.  UIctl will let you stop and start sshd on the phone.  Launch it now to see if sshd is running.  Click on the &#8216;load&#8217; button if it&#8217;s not.</p>
<p>Ping your phone from your computer with its IP address.  You can use the terminal on the phone to grab the IP address:</p>
<p><code><br />
# ifconfig en0<br />
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500<br />
        inet 10.0.1.194 netmask 0xffffff00 broadcast 10.0.1.255<br />
        ether 00:1c:b3:f0:0b:a6<br />
#<br />
</code></p>
<p>Ssh to the phone from your terminal.  The default root password is &#8216;dottie&#8217;.</p>
<p><code><br />
foobar:~ kord$ ssh root@10.0.1.194<br />
root@10.0.1.194's password:<br />
Last login: Wed Oct 10 13:45:22 2007 from 10.0.1.191<br />
# hostname<br />
Kord's iPhone<br />
#<br />
</code></p>
<p>Now add a syslog.conf file to /etc/: </p>
<p><code><br />
bash-3.2# echo "*.* @10.0.1.191" > /etc/syslog.conf<br />
bash-3.2# cat /etc/syslog.conf<br />
*.* @10.0.1.191<br />
</code></p>
<p>Obviously, you&#8217;ll want to use the IP address of the machine on which you are going to install Splunk.  Speaking of Splunk, at this point you should already have it installed.  If you don&#8217;t, <a href="http://www.splunk.com/index.php/predownload?d=progeneric?ac=kc1">download it here</a>, and install it now.  You can <a href="http://dev.splunk.com/2007/10/07/charting-your-osx-battery-usage-with-splunk/">reference my first hack</a> for instructions on getting Splunk up and running quickly on your system.    Smile.   Splunk goooood.</p>
<p>Back in your ssh session to the iPhone, you&#8217;ll need to move the syslogd executable to an alternate location, kill the old instance, and start the new one with a few parameters.</p>
<p><code><br />
# cd /usr/sbin/<br />
# mv syslogd syslogd.mine<br />
# launchctl stop com.apple.syslogd<br />
....wait for about 5 seconds....<br />
# /usr/sbin/syslogd.mine -bsd_out 1 &#038;<br />
</code></p>
<p>Syslogd should now use the new /etc/syslog.conf file that you just created when it starts up.  You can check if it&#8217;s running properly:</p>
<p><code><br />
# ps -ax |grep syslog<br />
  110  p0  S      0:02.91 /usr/sbin/syslogd.mine -bsd_out 1<br />
#<br />
</code></p>
<p>Now fire up Splunk, and hit your instance of it in a browser:  http://localhost:8000.  Click on the &#8216;admin&#8217; link in the top right, click on the &#8216;data inputs&#8217; tab at the top, &#8216;network ports&#8217; just below that, and then click on the &#8216;add input&#8217; button to the right.</p>
<p>Click on the UDP radio button under &#8217;source&#8217;.  The port listed should change to 514.  Click on the &#8216;add&#8217; button at the bottom.  You should now be getting data coming into Splunk on UDP port 514.  Grab some coffee whilst Splunk eats ALL the logfiles coming in from the iPhone.</p>
<p>Now let&#8217;s get Tinyproxy serving requests for Safari on the phone and logging through syslogd.  Check that Tinyproxy is running on the iPhone first:</p>
<p><code><br />
# ps -ax |grep tiny<br />
  354  ??  S      0:00.10 /usr/bin/tinyproxy<br />
  355  ??  S      0:00.00 /usr/bin/tinyproxy<br />
 1428  p1  S+     0:00.01 grep tiny<br />
</code></p>
<p>Edit tiny&#8217;s configuration file to set his logs to go to syslogd.  Keep in mind there is more to the config file than the few lines that I&#8217;m showing.</p>
<p><code><br />
# vi /usr/local/etc/tinyproxy/tinyproxy.conf<br />
~<br />
# log only errors<br />
#Logfile "/var/log/tinyproxy.log"<br />
#LogLevel Info<br />
Syslog On<br />
</code></p>
<p>Now on the iPhone, go to settings..wifi networks..<your network ssid>..http proxy.  Enter the host as 127.0.0.1 and the port as 8080, just as you see in the screenshot below:</p>
<p><img src="http://blogs.splunk.com/devuploads/2007/10/foo_0.png"/></p>
<p>Lastly, kill Tinyproxy so he&#8217;ll start logging correctly.  He restarts automagically, so all you need to do is kill the process ids:</p>
<p><code><br />
# ps -ax |grep tiny<br />
  354  ??  S      0:00.11 /usr/bin/tinyproxy<br />
  355  ??  S      0:00.05 /usr/bin/tinyproxy<br />
 1651  p1  S+     0:00.01 grep tiny<br />
# kill -9 354 355<br />
# ps -ax |grep tiny<br />
 1654  ??  S      0:00.01 /usr/bin/tinyproxy<br />
 1655  ??  S      0:00.00 /usr/bin/tinyproxy<br />
 1657  p1  S+     0:00.02 grep tiny<br />
#<br />
</code></p>
<p>That should be about it.  You should have Splunk filling up with logs that contain web requests being requested by the Safari browser on your iPhone.  Don&#8217;t forget to restore the syslog plist file, reboot, and fix it to lock after a few minutes timeout.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2007/10/10/splunk-hack-2-logging-safari-requests-on-the-iphone/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Splunk Hack #1 - Charting Your OSX Battery Usage with Splunk</title>
		<link>http://blogs.splunk.com/kordless/2007/10/07/charting-your-osx-battery-usage-with-splunk/</link>
		<comments>http://blogs.splunk.com/kordless/2007/10/07/charting-your-osx-battery-usage-with-splunk/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 04:08:45 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2007/10/07/charting-your-osx-battery-usage-with-splunk/</guid>
		<description><![CDATA[This is an easy-to-follow tutorial for charting battery usage on your Mac laptop with a small shell script and Splunk.  Watching your battery charge is as exciting as watching paint dry, but analyzing it over time is pretty interesting.  You may discover a few things about the software you run - like it [...]]]></description>
			<content:encoded><![CDATA[<p>This is an easy-to-follow tutorial for charting battery usage on your Mac laptop with a small shell script and Splunk.  Watching your battery charge is as exciting as watching paint dry, but analyzing it over time is pretty interesting.  You may discover a few things about the software you run - like it eats your battery&#8217;s amps for desert.</p>
<p>A friend of mine, Sean Dick, showed me a version of this idea using Splunk on Linux and a program called &#8216;apci&#8217;.   As I&#8217;m a Mac fanboy of sorts, I dug up a shell script for the Mac that will print out a single logfile-like line containing laptop battery information, including amp draw, amp-hours left, and more.  It&#8217;s aptly named &#8216;battery&#8217;, and you can download it <a href="http://www.mitt-eget.com/software/macosx/#battery">here</a>.</p>
<p>I suggest you put battery in a directory under your home directory, say something called &#8217;scripts&#8217;.  Head into &#8216;terminal&#8217; to start the dirty work.</p>
<p>Here&#8217;s an example output line from &#8216;battery short&#8217;:</p>
<p><code>G4:~ kord$ ./scripts/battery short<br />
2007-10-07 18:34:27 1 _________i__ 11.232V -1.454A 2.788Ah of 4.720Ah (59.1%) of 4.400Ah (107.3%) 13 cycles</code></p>
<p>The line of underscores with an &#8216;i&#8217; in it are the battery flags set.  &#8216;i&#8217; means my battery is installed.  Duh.  Other flags include whether the lid is closed, the battery is on fire, or it&#8217;s just on the charger.  See the battery.rtf file for more information on the flags.  I have a G4 laptop, but just got my battery replaced for free!  Only 13 cycles on it so far!</p>
<p>Splunk eats logfiles, so you&#8217;ll need to get a logfile rolling on your battery output.  I&#8217;m going to assume you know how to use vi (text editor) do the rest of this work.</p>
<p>You&#8217;ll need to set up a cronjob to create the logfile and continue logging to it every so often.    Switch to root and create a logfile for battery in /var/log: </p>
<p><code><br />
G4:~ kord$ su<br />
Password:<br />
G4:/Users/kord root# cd /var/log<br />
G4:/var/log root# touch battery.log<br />
G4:/var/log root# chown kord battery.log<br />
G4:/var/log root# ls -la battery.log<br />
-rw-r--r--   1 kord  wheel  0 Oct  7 18:45 battery.log<br />
G4:/var/log root# exit<br />
G4:~ kord$<br />
</code></p>
<p>Now use &#8216;crontab -e&#8217; and put in a line that looks something like the second line of this:</p>
<p><code><br />
G4:~ kord$ crontab -l<br />
* * * * *       /Users/kord/scripts/battery short >> /var/log/battery.log<br />
</code></p>
<p>That will cause the battery script to run once a minute and append it to the battery.log file in the log directory.  After a few minutes tail the logfile with &#8216;tail /var/log/battery.log&#8217; and make sure you&#8217;ve got data in there.  Also, I&#8217;ve edited my own crontab, but you could elect to do it as root (thus skipping the chown step above).</p>
<p>Obviously you will need Splunk installed to chart the battery usage out of the logfiles.  If you haven&#8217;t installed it already, there&#8217;s a free version up on the website you can <a href="http://www.splunk.com/index.php/predownload?d=kordless">download</a>.  Follow the instructions for installing it on OSX.</p>
<p>Assuming that you installed Splunk in in &#8216;/Applications/splunk/&#8217; you can do the following to start it:</p>
<p><code><br />
G4:~ root# cd /Applications/splunk<br />
G4:/Applications/splunk root# export SPLUNK_HOME='/Applications/splunk/'<br />
G4:/Applications/splunk root# ./bin/splunk start<br />
</code></p>
<p>Now you&#8217;ll need to <a href="http://www.splunkbase.com/addons/Inputs/Systems_Management/Monitoring/addon:OSX_Battery_Monitor">download</a> my addon for Splunk, which is basically a bundle of configuration files.  For reference, I also put the battery script in the tar file, along with an example crontab file.  To get the bundle in the right place, start by un-taring it:</p>
<p><code><br />
G4:~ kord$ tar xvfz battery.tar.gz<br />
battery/<br />
battery/addon.conf<br />
battery/bin/<br />
battery/bin/battery<br />
battery/bin/battery.rtf<br />
battery/bin/crontab.example<br />
battery/props.conf<br />
battery/screenshot.jpg<br />
battery/transforms.conf<br />
</code></p>
<p>Now move it to the correct location in Splunk&#8217;s directory:</p>
<p><code><br />
G4:~ kord$ su<br />
Password:<br />
G4:/Users/kord root# mv battery /Applications/splunk/etc/bundles/<br />
</code></p>
<p>And restart Splunk now:</p>
<p><code><br />
G4:/Users/kord root# /Applications/splunk/bin/splunk restart<br />
</code></p>
<p>We&#8217;ll spend the rest of our time in a browser, using Splunk&#8217;s kick-ass web interface.</p>
<p>If you left the default port alone, you should be able to fire up Firefox and hit http://localhost:8000 and see the initial login screen (or not if you are using the free version).  I&#8217;ll leave the particulars of getting to the initial search interface on Splunk to you.</p>
<p>Add the battery.log file to the list of files Splunk monitors.  Click on &#8216;admin&#8217;, then click on the &#8216;data inputs&#8217; tab.  Click on the &#8216;Add input&#8217; link to the right of &#8216;Files &#038; Directories&#8217; at the bottom.  Leave the data access to &#8216;tail&#8217; and give the full path to the logfile -  &#8216;/var/log/battery.log&#8217; in my example above.  Host can be constant, DNS name doesn&#8217;t matter, and set the source type pulldown to &#8216;_battery&#8217;.  Remember, this sourcetype won&#8217;t be in the list until you install the battery bundle.</p>
<p>Click on &#8216;add&#8217; to add the source type.  Go get a cup of coffee while Splunk eats this and other files on your computer and builds the index.</p>
<p>Back from the caffeine, you should now click on the &#8217;splunk>&#8217; logo at the top left.  Type in the following in the search bar, sans the quotes: &#8217;source::/var/log/battery.log&#8217;.  Click on the &#8216;fields&#8217; pulldown on the left and check a few extracted fields, such as battery_ah_remaining, battery_draw, battery_percent, and battery_volts.  Click on &#8216;fields&#8217; again to close and reload with the extracted fields showing.</p>
<p>You should get something that looks like this:</p>
<p><img src="http://blogs.splunk.com/devuploads/2007/10/splunk_fields.jpg" alt="" /></p>
<p>If you have about an hour&#8217;s or so data logged, try entering &#8217;source::/var/log/battery.log | timechart avg(battery_draw)&#8217; in the search box at the top to generate a report for the last 60 minutes.</p>
<p>Here&#8217;s what my amp draw looks like for the last 3 hours:</p>
<p><img src="http://blogs.splunk.com/devuploads/2007/10/splunk_graph.jpg" alt="" /></p>
<p>The move &#8216;up&#8217; in the graph halfway through is actually a drop in amps drawn on the battery when I restarted Firefox.  The cause?  Firefox had a Flash game running in another tab, and it had eventually heated up the processor enough to kick on the fans!</p>
<p>Here&#8217;s another one, showing the evidence of me having a newer battery installed - almost five hours of continuous usage after 4PM, with only a few screen sleeps:</p>
<p><img src="http://blogs.splunk.com/devuploads/2007/10/splunk_graph_2.jpg" alt="" /></p>
<p>It&#8217;s interesting how the laptop charges at a rate almost the same as it discharges.  It preserves battery life doing it that way, especially with the new lithium-polymer batteries.</p>
<p>See what else you can dig up about your battery.  Try charting with some of the flags that are set - like how often the charger is on the laptop, or what the draw rate is if you have the screen clamshell closed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2007/10/07/charting-your-osx-battery-usage-with-splunk/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tech Talk #1 - Pipelines and Processors</title>
		<link>http://blogs.splunk.com/kordless/2007/10/01/tech-talk-1-pipelines-and-processors/</link>
		<comments>http://blogs.splunk.com/kordless/2007/10/01/tech-talk-1-pipelines-and-processors/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 16:53:15 +0000</pubDate>
		<dc:creator>kordless</dc:creator>
		
		<category><![CDATA[dev]]></category>

		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://blogs.splunk.com/kordless/2007/10/01/tech-talk-1-pipelines-and-processors/</guid>
		<description><![CDATA[Rob Das gives us the skinny on Splunkd&#8217;s use of various pipelines and processors.  This is the first pass at Splunk&#8217;s tech talks, so the screen caps of the terminal are a little blurry on the smaller versions.  We&#8217;ll be re-filming this particular piece again this week, except this time the beer guy [...]]]></description>
			<content:encoded><![CDATA[<p>Rob Das gives us the skinny on Splunkd&#8217;s use of various pipelines and processors.  This is the first pass at Splunk&#8217;s tech talks, so the screen caps of the terminal are a little blurry on the smaller versions.  We&#8217;ll be re-filming this particular piece again this week, except this time the beer guy is going to do it.</p>
<p><a href="http://video.google.com/videoplay?docid=5537946582161381694&#038;hl=en"><img class="pic" width="120" height="90" border="0" src="http://blogs.splunk.com/devuploads/2007/09/tech_talk_1_screenshot.jpg"/></a></p>
<p>More video formats are available from Splunk&#8217;s <a href="http://dev.splunk.com/videos-from-splunk/">Tech Talks</a> section.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.splunk.com/kordless/2007/10/01/tech-talk-1-pipelines-and-processors/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
