<?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 Re: Extracting fields from JSON - Whois Add On in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192164#M38314</link>
    <description>&lt;P&gt;Thanks, you put me in the right path!&lt;/P&gt;

&lt;P&gt;The final search was:&lt;/P&gt;

&lt;P&gt;index=pan* dest!=192.168.0.0/16 dest!=10.0.0.0/8 dest!=172.16.0.0/12 | dedup dest | head 10 |rename dest as ip | lookup whoisLookup ip OUTPUT whois | eval whois = substr(whois, 1, len(whois)-2) | eval whois = substr(whois, 3, len(whois)) | spath input=whois | table ip org city country&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jun 2014 17:56:58 GMT</pubDate>
    <dc:creator>zowa</dc:creator>
    <dc:date>2014-06-17T17:56:58Z</dc:date>
    <item>
      <title>Extracting fields from JSON - Whois Add On</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192162#M38312</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am using the Whois Add On to get Whois information from ip addresses. Here is an example:&lt;/P&gt;

&lt;P&gt;index=pan* dest!=192.168.0.0/16 dest!=10.0.0.0/8 dest!=172.16.0.0/12 | dedup dest | head 3  | rename dest as ip | lookup whoisLookup ip OUTPUT whois | table _time ip whois&lt;/P&gt;

&lt;P&gt;It creates a new field called whois, with the information from the online whois database:&lt;/P&gt;

&lt;P&gt;['{"DomainName":"8.8.8.8","RegistryData":{"AbuseContact":{"Email":"&lt;A href="mailto:arin-contact@google.com"&gt;arin-contact@google.com&lt;/A&gt;","Name":"Google Inc","Phone":"+1-650-253-0000"},"AdministrativeContact":{"Email":"&lt;A href="mailto:arin-contact@google.com"&gt;arin-contact@google.com&lt;/A&gt;","Name":"Google Inc","Phone":"+1-650-253-0000"},"BillingContact":null,"CreatedDate":"2014-03-14T16:52:05-04:00","RawText":null,"Registrant":{"Address":"1600 Amphitheatre Parkway","City":"Mountain View","Country":"US","Name":"Google Inc.","PostalCode":"94043","StateProv":"CA"},"TechnicalContact":{"Email":"&lt;A href="mailto:arin-contact@google.com"&gt;arin-contact@google.com&lt;/A&gt;","Name":"Google Inc","Phone":"+1-650-253-0000"},"UpdatedDate":"2014-03-14T16:52:05-04:00","ZoneContact":null}}']&lt;/P&gt;

&lt;P&gt;I am trying to use spath to extract the fields from the JSON results, but no success yet... I´ve read somewhere that Splunk 6 extract the JSON fields automatically... Well... Any idea how to extract the fields, in order to present the results in a more organized way? That would help a lot! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jun 2014 21:56:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192162#M38312</guid>
      <dc:creator>zowa</dc:creator>
      <dc:date>2014-06-08T21:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting fields from JSON - Whois Add On</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192163#M38313</link>
      <description>&lt;P&gt;The string is not pure JSON, and spath needs a pure JSON string. You have to strip the square brackets (&lt;CODE&gt;[]&lt;/CODE&gt;) and single quotes (&lt;CODE&gt;'&lt;/CODE&gt;) around the JSON. e.g., &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval whois = substr(whois,2) | eval whois = substr(whois,-2) | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or something a little more precise.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2014 05:53:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192163#M38313</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2014-06-09T05:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting fields from JSON - Whois Add On</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192164#M38314</link>
      <description>&lt;P&gt;Thanks, you put me in the right path!&lt;/P&gt;

&lt;P&gt;The final search was:&lt;/P&gt;

&lt;P&gt;index=pan* dest!=192.168.0.0/16 dest!=10.0.0.0/8 dest!=172.16.0.0/12 | dedup dest | head 10 |rename dest as ip | lookup whoisLookup ip OUTPUT whois | eval whois = substr(whois, 1, len(whois)-2) | eval whois = substr(whois, 3, len(whois)) | spath input=whois | table ip org city country&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 17:56:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-fields-from-JSON-Whois-Add-On/m-p/192164#M38314</guid>
      <dc:creator>zowa</dc:creator>
      <dc:date>2014-06-17T17:56:58Z</dc:date>
    </item>
  </channel>
</rss>

