<?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: How can I extract nested JSON at index time as their own event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-nested-JSON-at-index-time-as-their-own-event/m-p/308588#M92558</link>
    <description>&lt;P&gt;Ok, in the question I am trying to remove the top level Json and trailing ]} so what remains is a bunch of Json objects {...} separated by commas.&lt;BR /&gt;
The regex strings matched and worked but the nullQueue options will remove the whole event where it finds a match to the regex. So I was unintentionally removing the whole event. &lt;BR /&gt;
What I needed to use was the SEDCMD in props.conf like so&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-removeNestingStart = s/(\{\"success\":true,\"message\":\"\",\"result\":\[)//
SEDCMD-removeNestingEnd =s/(\]\})//
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This succesfully removes only the matched string.&lt;/P&gt;

&lt;P&gt;Hopefully this'll help any one elses mis-understanding&lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2018 09:42:32 GMT</pubDate>
    <dc:creator>DHastie</dc:creator>
    <dc:date>2018-02-23T09:42:32Z</dc:date>
    <item>
      <title>How can I extract nested JSON at index time as their own event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-nested-JSON-at-index-time-as-their-own-event/m-p/308587#M92557</link>
      <description>&lt;P&gt;I am using the REST API  to get a large sample of JSON data every minute from the Bittrex Exchange but I would like to get each of the nested objects as their own event. &lt;BR /&gt;
A sample of the data.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;{&lt;BR /&gt;
  "success": true,&lt;BR /&gt;
  "message": "",&lt;BR /&gt;
  "result": [&lt;BR /&gt;
    {&lt;BR /&gt;
      "MarketName": "BTC-1ST",&lt;BR /&gt;
      "High": 0.00004356,&lt;BR /&gt;
      "Low": 0.00003995,&lt;BR /&gt;
      "Volume": 275838.36163835,&lt;BR /&gt;
      "Last": 0.00004,&lt;BR /&gt;
      "BaseVolume": 11.26409631,&lt;BR /&gt;
      "TimeStamp": "2018-02-22T14:26:44.74",&lt;BR /&gt;
      "Bid": 0.0000399,&lt;BR /&gt;
      "Ask": 0.0000404,&lt;BR /&gt;
      "OpenBuyOrders": 189,&lt;BR /&gt;
      "OpenSellOrders": 4095,&lt;BR /&gt;
      "PrevDay": 0.00004236,&lt;BR /&gt;
      "Created": "2017-06-06T01:22:35.727"&lt;BR /&gt;
    },&lt;BR /&gt;
    {&lt;BR /&gt;
      "MarketName": "BTC-2GIVE",&lt;BR /&gt;
      "High": 0.00000118,&lt;BR /&gt;
      "Low": 0.00000113,&lt;BR /&gt;
      "Volume": 845591.96670095,&lt;BR /&gt;
      "Last": 0.00000114,&lt;BR /&gt;
      "BaseVolume": 0.96678559,&lt;BR /&gt;
      "TimeStamp": "2018-02-22T14:26:43.647",&lt;BR /&gt;
      "Bid": 0.00000114,&lt;BR /&gt;
      "Ask": 0.00000115,&lt;BR /&gt;
      "OpenBuyOrders": 195,&lt;BR /&gt;
      "OpenSellOrders": 1235,&lt;BR /&gt;
      "PrevDay": 0.00000118,&lt;BR /&gt;
      "Created": "2016-05-16T06:44:15.287"&lt;BR /&gt;
    },...&lt;BR /&gt;
]&lt;BR /&gt;
}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I also have a props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[bittrex-json]
TRANSFORMS-nullJsonNestingStart= removeNestingStart
TRANSFORMS-nullJsonNestingEnd= removeNestingEnd
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = true
TIME_FORMAT=%Y-%m-%dT%H:%M:%S.%f
category = Application
disabled = false
pulldown_type = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and a the transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[removeNestingStart]
REGEX = (\{\"success\":true,\"message\":\"\",\"result\":\[)
DEST_KEY = queue
FORMAT = nullQueue

[removeNestingEnd]
REGEX = (\]\})
DEST_KEY=queue
FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I tested the regex and it matches only the top level before nested objects start. It also only catches the final "] }".&lt;BR /&gt;
If my understanding is correct, this set up should keep the nested portions to be indexed as the other sections are sent to nullQueue. &lt;BR /&gt;
However, when I use my props.conf sourcetype the events preview shows 0 events. Somehow my regex is matching and sending all the data to Nullqueue.&lt;/P&gt;

&lt;P&gt;I know that I can use the spath command to extract the objects at search time. However as each object has it's own timestamp within, I'd like each object to be it's own event.&lt;BR /&gt;
Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:28:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-nested-JSON-at-index-time-as-their-own-event/m-p/308587#M92557</guid>
      <dc:creator>DHastie</dc:creator>
      <dc:date>2018-02-22T16:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract nested JSON at index time as their own event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-nested-JSON-at-index-time-as-their-own-event/m-p/308588#M92558</link>
      <description>&lt;P&gt;Ok, in the question I am trying to remove the top level Json and trailing ]} so what remains is a bunch of Json objects {...} separated by commas.&lt;BR /&gt;
The regex strings matched and worked but the nullQueue options will remove the whole event where it finds a match to the regex. So I was unintentionally removing the whole event. &lt;BR /&gt;
What I needed to use was the SEDCMD in props.conf like so&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-removeNestingStart = s/(\{\"success\":true,\"message\":\"\",\"result\":\[)//
SEDCMD-removeNestingEnd =s/(\]\})//
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This succesfully removes only the matched string.&lt;/P&gt;

&lt;P&gt;Hopefully this'll help any one elses mis-understanding&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 09:42:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-nested-JSON-at-index-time-as-their-own-event/m-p/308588#M92558</guid>
      <dc:creator>DHastie</dc:creator>
      <dc:date>2018-02-23T09:42:32Z</dc:date>
    </item>
  </channel>
</rss>

