<?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: Split a nested json array with key/value pairs at index time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392365#M70080</link>
    <description>&lt;P&gt;Thanks for the reply harsmarvania57.  That answers part of the question but the overall splitting of events should be possible. Here are a couple links where people were successful. I have tried to replicate what they did but I haven't had much luck as the line-breaker appears as if it is getting ignored. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/704459/how-to-split-json-array-into-multiple-events-using.html" target="_blank"&gt;https://answers.splunk.com/answers/704459/how-to-split-json-array-into-multiple-events-using.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/289520/how-to-split-a-json-array-into-multiple-events-wit.html" target="_blank"&gt;https://answers.splunk.com/answers/289520/how-to-split-a-json-array-into-multiple-events-wit.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This is my props.conf trying to use Line_breaker to split the events.  Once I get that working I would then use part of what you provided to clean up the Keys/Content fields.  I have tested this in regex and the matches appear to work. &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
[gpb_kv_test7]&lt;BR /&gt;
DATETIME_CONFIG = &lt;BR /&gt;
INDEXED_EXTRACTIONS = json&lt;BR /&gt;
LINE_BREAKER = ((?!"),(?!")|[\r\n]+)&lt;BR /&gt;
NO_BINARY_CHECK = true&lt;BR /&gt;
SEDCMD-remove_prefix = s/({\"Source\"\S+?\"Rows\":[)//g&lt;BR /&gt;
SEDCMD-remove_suffix = s/]}//g&lt;BR /&gt;
SHOULD_LINEMERGE = false&lt;BR /&gt;
TIMESTAMP_FIELDS = Rows{}.Timestamp&lt;BR /&gt;
category = Structured&lt;BR /&gt;
description = JavaScript Object Notation format. For more information, visit &lt;A href="http://json.org/" target="_blank"&gt;http://json.org/&lt;/A&gt;&lt;BR /&gt;
disabled = false&lt;BR /&gt;
pulldown_type = true&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Leaves me with a single event like this: &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
{"Timestamp":1554629642020,"Keys":{"name":"Processor"},"Content":{"free-memory":1123798432}},{"Timestamp":1554629642020,"Keys":{"name":"lsmpi_io"},"Content":{"free-memory":824}}&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:58:35 GMT</pubDate>
    <dc:creator>loeweps</dc:creator>
    <dc:date>2020-09-29T23:58:35Z</dc:date>
    <item>
      <title>Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392363#M70078</link>
      <description>&lt;P&gt;I am searching for a way to split an json array at index time with key value pairs. &lt;/P&gt;

&lt;P&gt;Raw Data: &lt;BR /&gt;
&lt;PRE&gt;{"Source":"192.16.0.1:57913","Telemetry":{"node_id_str":"border_1","subscription_id_str":"101","encoding_path":"Cisco-IOS-XE-memory-oper:memory-statistics/memory-statistic","collection_id":0,"collection_start_time":0,"msg_timestamp":1554539606730,"collection_end_time":0},"Rows":[{"Timestamp":1554539606730,"Keys":{"name":"Processor"},"Content":{"used-memory":325518464}},{"Timestamp":1554539606730,"Keys":{"name":"lsmpi_io"},"Content":{"used-memory":6294304}}]}&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;I would like to separate this into two events. Keeping or even discarding the header. Though keeping the node_id_str is useful. &lt;/P&gt;

&lt;P&gt;Event1: &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
{&lt;BR /&gt;&lt;BR /&gt;
   "Source":"192.16.0.1:57913",&lt;BR /&gt;
   "node_id_str":"border_1",&lt;BR /&gt;
   "encoding_path":"Cisco-IOS-XE-memory-oper:memory-statistics/memory-statistic",&lt;BR /&gt;
   "Timestamp":1554539606730,&lt;BR /&gt;
   "name":"lsmpi_io"&lt;BR /&gt;
   "used-memory":6294304&lt;BR /&gt;
}&lt;BR /&gt;
&lt;/PRE&gt;&lt;BR /&gt;
Event2:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
{&lt;BR /&gt;&lt;BR /&gt;
   "Source":"192.16.0.1:57913",&lt;BR /&gt;
   "node_id_str":"border_1",&lt;BR /&gt;
   "encoding_path":"Cisco-IOS-XE-memory-oper:memory-statistics/memory-statistic",&lt;BR /&gt;
   "Timestamp":1554539606730,&lt;BR /&gt;
   "name":"Processor"&lt;BR /&gt;
   "used-memory":325518464&lt;BR /&gt;
}&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Or alternatively if there isn't an easy way. Just keep the data in Rows{}&lt;BR /&gt;
Event1: &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
{&lt;BR /&gt;&lt;BR /&gt;
   "Timestamp":1554539606730,&lt;BR /&gt;
   "name":"lsmpi_io"&lt;BR /&gt;
   "used-memory":6294304&lt;BR /&gt;
}&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;I am using indexed_extractions = json. I have tried working with line breaker, must_break_after,  and sedcmd removing the header  but I haven't had much luck. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392363#M70078</guid>
      <dc:creator>loeweps</dc:creator>
      <dc:date>2020-09-29T23:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392364#M70079</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Based on my knowledge, you can't separate those in two events but you can try below config to achieve last event which you mentioned in your question.&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ yoursourcetype]
SEDCMD-test=s/\"Keys"\:\{([^\}]*)\}(\,)\"Content\"\:\{([^\}]*)\}/\1\2\3/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Data will look like as given in below screenshot&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6821iC80CE5CEEB4A2045/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2019 17:06:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392364#M70079</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-04-06T17:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392365#M70080</link>
      <description>&lt;P&gt;Thanks for the reply harsmarvania57.  That answers part of the question but the overall splitting of events should be possible. Here are a couple links where people were successful. I have tried to replicate what they did but I haven't had much luck as the line-breaker appears as if it is getting ignored. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/704459/how-to-split-json-array-into-multiple-events-using.html" target="_blank"&gt;https://answers.splunk.com/answers/704459/how-to-split-json-array-into-multiple-events-using.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/289520/how-to-split-a-json-array-into-multiple-events-wit.html" target="_blank"&gt;https://answers.splunk.com/answers/289520/how-to-split-a-json-array-into-multiple-events-wit.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This is my props.conf trying to use Line_breaker to split the events.  Once I get that working I would then use part of what you provided to clean up the Keys/Content fields.  I have tested this in regex and the matches appear to work. &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
[gpb_kv_test7]&lt;BR /&gt;
DATETIME_CONFIG = &lt;BR /&gt;
INDEXED_EXTRACTIONS = json&lt;BR /&gt;
LINE_BREAKER = ((?!"),(?!")|[\r\n]+)&lt;BR /&gt;
NO_BINARY_CHECK = true&lt;BR /&gt;
SEDCMD-remove_prefix = s/({\"Source\"\S+?\"Rows\":[)//g&lt;BR /&gt;
SEDCMD-remove_suffix = s/]}//g&lt;BR /&gt;
SHOULD_LINEMERGE = false&lt;BR /&gt;
TIMESTAMP_FIELDS = Rows{}.Timestamp&lt;BR /&gt;
category = Structured&lt;BR /&gt;
description = JavaScript Object Notation format. For more information, visit &lt;A href="http://json.org/" target="_blank"&gt;http://json.org/&lt;/A&gt;&lt;BR /&gt;
disabled = false&lt;BR /&gt;
pulldown_type = true&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Leaves me with a single event like this: &lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
{"Timestamp":1554629642020,"Keys":{"name":"Processor"},"Content":{"free-memory":1123798432}},{"Timestamp":1554629642020,"Keys":{"name":"lsmpi_io"},"Content":{"free-memory":824}}&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:58:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392365#M70080</guid>
      <dc:creator>loeweps</dc:creator>
      <dc:date>2020-09-29T23:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392366#M70081</link>
      <description>&lt;P&gt;In that case use below configuration in props.conf, do not use &lt;CODE&gt;INDEXED_EXTRACTIONS = json&lt;/CODE&gt; because if you will use &lt;CODE&gt;INDEXED_EXTRACTIONS = json&lt;/CODE&gt; then it will skip certain queues while parsing the data and due to that other settings will not work. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
LINE_BREAKER = (\[|\,)\{\"Timestamp
SEDCMD-a = s/\{\"Source\"\:[^\}]*\}\,\"Rows\"\://
SEDCMD-b = s/\]\}//
SEDCMD-c = s/\"Keys"\:\{([^\}]*)\}(\,)\"Content\"\:\{([^\}]*)\}/\1\2\3/g
SHOULD_LINEMERGE = false
TIME_PREFIX = \"Timestamp\"\:
disabled = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have used below dummy data to extract relevant event &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"Source":"192.16.0.1:57913","Telemetry":{"node_id_str":"border_1","subscription_id_str":"101","encoding_path":"Cisco-IOS-XE-memory-oper:memory-statistics/memory-statistic","collection_id":0,"collection_start_time":0,"msg_timestamp":1554539606730,"collection_end_time":0},"Rows":[{"Timestamp":1554539606730,"Keys":{"name":"Processor"},"Content":{"used-memory":325518464}},{"Timestamp":1554539606730,"Keys":{"name":"lsmpi_io"},"Content":{"used-memory":6294304}}]}
{"Source":"192.16.0.12:57913","Telemetry":{"node_id_str":"border_1","subscription_id_str":"101","encoding_path":"Cisco-IOS-XE-memory-oper:memory-statistics/memory-statistic","collection_id":0,"collection_start_time":0,"msg_timestamp":1553539606730,"collection_end_time":0},"Rows":[{"Timestamp":1553539606730,"Keys":{"name":"Processor"},"Content":{"used-memory":64744628}},{"Timestamp":1553539606730,"Keys":{"name":"lsmpi_io"},"Content":{"used-memory":53656}}]}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Apr 2019 13:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392366#M70081</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-04-07T13:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392367#M70082</link>
      <description>&lt;P&gt;The problem is probably less with your settings and more with your methodology.  For linebreaking and timestamping, the props.conf must be deployed to the first full instance of splunk that handles the data.  Many people do not understand that for any OS, there are 2 different types of Splunk: the Universal Forwarder ( &lt;CODE&gt;UF&lt;/CODE&gt; ) and full Splunk Enterprise (typically designated as either &lt;CODE&gt;Heavy Forwarder&lt;/CODE&gt; or &lt;CODE&gt;Indexer&lt;/CODE&gt;).  If all you are doing is forwarding events, be sure to use the UF for this.  So now that you are forwarding your events with a UF, that is not the place for these settings (because it is not a full instance of Splunk); you need to deploy your props.conf to your HF (which hopefully you are not using, because there really is no good reason to) or Indexer tier.  Next you need to restart all Splunk instance there.  When I say "all Splunk intances" be aware that sometimes there is more than one instance of Splunk installed on a node, so be sure to restart them all.  Next, be sure that you are validating your settings against events that have been forwarded in after the restarts.  You may have been timestamping events wrong and throwing them into the future.  If so (and you may not even be aware that this is so), a simple &lt;CODE&gt;Last 5 minutes&lt;/CODE&gt; on the &lt;CODE&gt;Timepicker&lt;/CODE&gt; maybe showing you events that were forwarded and indexed (and incorrectly timestamped), long before the restarts.  So be sure to always use a value of &lt;CODE&gt;All time&lt;/CODE&gt; in your timepicker along with adding &lt;CODE&gt;_index_earliest = -5m&lt;/CODE&gt; (or similar) to your search SPL.  This way, even if you are still timestamping incorrectly (either into the future or into the past), you will see see recently-indexed events to use to validate the other settings.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 13:32:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392367#M70082</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-07T13:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392368#M70083</link>
      <description>&lt;P&gt;Thanks again harsmarvania57. Removing indexed_extractions and replacing it with kv_mode=json worked to split the events when I added them via json file. If I use the HEC to stream events to the Splunk instance it would still ignore the line-breaker but not the rest of the commands. I ended up resolving the issue by splitting the events at the source(kafka).  I found an option within Kafka connect to send the events to the raw HEC endpoint instead of the HEC event endpoint but I didn't get to test that option as the issue was already solved.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392368#M70083</guid>
      <dc:creator>loeweps</dc:creator>
      <dc:date>2020-09-29T23:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Split a nested json array with key/value pairs at index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392369#M70084</link>
      <description>&lt;P&gt;It's good that issue is resolved, you can accept my answer if it really helped. Regarding HEC endpoints, when you send data to HEC event endpoint it will skip few pipelines on Indexer and due to that above props config will not work, in this case you need to use HEC raw eventpoint which you already figured out.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 12:25:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-a-nested-json-array-with-key-value-pairs-at-index-time/m-p/392369#M70084</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-04-09T12:25:42Z</dc:date>
    </item>
  </channel>
</rss>

