<?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 is it possible to have a custom command return json to splunk? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/is-it-possible-to-have-a-custom-command-return-json-to-splunk/m-p/183838#M36810</link>
    <description>&lt;P&gt;I have a RESTful webservice which returns me a fairly complex json. I wish to pass it as-is to splunk and hope for splunk toparse it into key=value pairs.&lt;/P&gt;

&lt;P&gt;What do i have to do? I can not seem to find a sample &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jan 2015 17:22:03 GMT</pubDate>
    <dc:creator>dominiquevocat</dc:creator>
    <dc:date>2015-01-14T17:22:03Z</dc:date>
    <item>
      <title>is it possible to have a custom command return json to splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/is-it-possible-to-have-a-custom-command-return-json-to-splunk/m-p/183838#M36810</link>
      <description>&lt;P&gt;I have a RESTful webservice which returns me a fairly complex json. I wish to pass it as-is to splunk and hope for splunk toparse it into key=value pairs.&lt;/P&gt;

&lt;P&gt;What do i have to do? I can not seem to find a sample &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 17:22:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/is-it-possible-to-have-a-custom-command-return-json-to-splunk/m-p/183838#M36810</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2015-01-14T17:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: is it possible to have a custom command return json to splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/is-it-possible-to-have-a-custom-command-return-json-to-splunk/m-p/183839#M36811</link>
      <description>&lt;P&gt;Surprisingly simple....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;url="https://xxx/wapi/xxx"
values={'ip_address' : ipfield}
data = urllib.urlencode(values)

passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, url, USERNAME, PASSWORD)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
req = urllib2.Request(url, data)
pagehandle = urllib2.urlopen(req)

results=json.loads(pagehandle.read())
splunk.Intersplunk.outputResults( results )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jan 2015 08:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/is-it-possible-to-have-a-custom-command-return-json-to-splunk/m-p/183839#M36811</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2015-01-16T08:39:50Z</dc:date>
    </item>
  </channel>
</rss>

