<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Getting interesting field's data for Custom Command's Calculation in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74826#M15284</link>
    <description>&lt;P&gt;Hi everyone, I am doing a &lt;STRONG&gt;custom command for some calculation&lt;/STRONG&gt;, and i &lt;STRONG&gt;needed one of the fields&lt;/STRONG&gt; which I have loaded in from the API using this following code in &lt;STRONG&gt;my first Python File&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    url = 'intended API's url'
    page = urllib2.urlopen(url)
    content = page.read()
    dengDictionary = json.loads(content)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;STRONG&gt;field&lt;/STRONG&gt; which i &lt;STRONG&gt;needed for the calculation is now in one of my interesting fields&lt;/STRONG&gt; when i look at the &lt;STRONG&gt;Splunk Search App&lt;/STRONG&gt;. What do I have to do, or how should I do it, such that it will be able to get this &lt;STRONG&gt;interesting field&lt;/STRONG&gt; into my &lt;STRONG&gt;second Python file&lt;/STRONG&gt; for the calculation when I run my Custom Command?&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2013 03:29:00 GMT</pubDate>
    <dc:creator>bloodstrife</dc:creator>
    <dc:date>2013-09-27T03:29:00Z</dc:date>
    <item>
      <title>Getting interesting field's data for Custom Command's Calculation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74826#M15284</link>
      <description>&lt;P&gt;Hi everyone, I am doing a &lt;STRONG&gt;custom command for some calculation&lt;/STRONG&gt;, and i &lt;STRONG&gt;needed one of the fields&lt;/STRONG&gt; which I have loaded in from the API using this following code in &lt;STRONG&gt;my first Python File&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    url = 'intended API's url'
    page = urllib2.urlopen(url)
    content = page.read()
    dengDictionary = json.loads(content)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;STRONG&gt;field&lt;/STRONG&gt; which i &lt;STRONG&gt;needed for the calculation is now in one of my interesting fields&lt;/STRONG&gt; when i look at the &lt;STRONG&gt;Splunk Search App&lt;/STRONG&gt;. What do I have to do, or how should I do it, such that it will be able to get this &lt;STRONG&gt;interesting field&lt;/STRONG&gt; into my &lt;STRONG&gt;second Python file&lt;/STRONG&gt; for the calculation when I run my Custom Command?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2013 03:29:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74826#M15284</guid>
      <dc:creator>bloodstrife</dc:creator>
      <dc:date>2013-09-27T03:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting interesting field's data for Custom Command's Calculation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74827#M15285</link>
      <description>&lt;P&gt;Whether or not a field is in the "selected" fields or in the "interesting fields" area doesn't really matter in a way.  If it's present in &lt;EM&gt;either&lt;/EM&gt; area, that means that the field is present in the search results, which in turn means that your custom commands can access it. &lt;/P&gt;

&lt;P&gt;As to how in general to make sure the field makes it to your custom command(s) safely,  just &lt;/P&gt;

&lt;P&gt;1) don't have a &lt;CODE&gt;fields&lt;/CODE&gt; command whack it away,&lt;BR /&gt;&lt;BR /&gt;
2) if you've one or more transforming commands like &lt;CODE&gt;stats&lt;/CODE&gt;, remember that you have to pass it on somehow (eg with with &lt;CODE&gt;last(foo)&lt;/CODE&gt;),&lt;BR /&gt;&lt;BR /&gt;
3) if your custom command is in a postProcess search make sure to read up on postProcess pitfalls and have the field referenced somewhere explicitly in the base search like with a &lt;CODE&gt;fields&lt;/CODE&gt; clause on the end of the search.  If it's not explicitly in there Splunk may be optimizing it away which will make it seem to vanish from your base search results. &lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2013 07:33:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74827#M15285</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-09-28T07:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting interesting field's data for Custom Command's Calculation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74828#M15286</link>
      <description>&lt;P&gt;Hi sideview, thanks for your time.&lt;BR /&gt;
I have just started on splunk and to be honest i know very little about it.&lt;/P&gt;

&lt;P&gt;I would like to ask if the usage of something like this would allow me to actually use my custom command with a interesting field:&lt;/P&gt;

&lt;P&gt;sourcetype="json_onemap" | top center&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;center is one of my interesting fields&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;If i replace the "top" command, to my very own custom command, logically it would work right?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 03:50:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74828#M15286</guid>
      <dc:creator>bloodstrife</dc:creator>
      <dc:date>2013-10-01T03:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Getting interesting field's data for Custom Command's Calculation</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74829#M15287</link>
      <description>&lt;P&gt;Yep.   At each pipe just picture a bunch of rows, each of which is just a set of key value pairs.  A custom command can receive this and process it just like one of the core commands like "top" does.  &lt;/P&gt;

&lt;P&gt;Also if you feel like you're not finding enough examples of custom python search commands in the docs, remember you can read the source any of the ones that ship - eg in the search app - "$SPLUNK_HOME/etc/apps/search/bin"&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 19:05:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-interesting-field-s-data-for-Custom-Command-s/m-p/74829#M15287</guid>
      <dc:creator>nick</dc:creator>
      <dc:date>2013-10-04T19:05:03Z</dc:date>
    </item>
  </channel>
</rss>

