<?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 Split json array of objects into multiple events in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382402#M68935</link>
    <description>&lt;P&gt;We have data structured in the following format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[
  {
    "container_id": "1",
    "executor_id": "1",
    "framework_id": "2",
    "statistics": {
      "cpus_limit": 1,
      "cpus_nr_periods": 1
    },
    "status": {
      "container_id": {
        "value": "123"
      }
    }
  },
   {
    "container_id": "2",
    "executor_id": "1",
    "framework_id": "3",
    "statistics": {
      "cpus_limit": 1.1,
      "cpus_nr_periods": 2
    },
    "status": {
      "container_id": {
        "value": "124"
      }
    }
  }
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We would like to split it into seperate events in  a way that we end up with:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 1&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {
        "container_id": "1",
        "executor_id": "1",
        "framework_id": "2",
        "statistics": {
          "cpus_limit": 1,
          "cpus_nr_periods": 1
        },
        "status": {
          "container_id": {
            "value": "123"
          }
        }
      }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Event 2&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
        "container_id": "2",
        "executor_id": "1",
        "framework_id": "3",
        "statistics": {
          "cpus_limit": 1.1,
          "cpus_nr_periods": 2
        },
        "status": {
          "container_id": {
            "value": "124"
          }
        }
      }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We can not do a split by '},' as this would also split on  &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;"cpus_nr_periods":  &lt;STRONG&gt;},&lt;/STRONG&gt; "status": {&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Is there any way we can split those events (on index time)&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 21:58:02 GMT</pubDate>
    <dc:creator>sboogaar</dc:creator>
    <dc:date>2020-09-29T21:58:02Z</dc:date>
    <item>
      <title>Split json array of objects into multiple events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382402#M68935</link>
      <description>&lt;P&gt;We have data structured in the following format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[
  {
    "container_id": "1",
    "executor_id": "1",
    "framework_id": "2",
    "statistics": {
      "cpus_limit": 1,
      "cpus_nr_periods": 1
    },
    "status": {
      "container_id": {
        "value": "123"
      }
    }
  },
   {
    "container_id": "2",
    "executor_id": "1",
    "framework_id": "3",
    "statistics": {
      "cpus_limit": 1.1,
      "cpus_nr_periods": 2
    },
    "status": {
      "container_id": {
        "value": "124"
      }
    }
  }
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We would like to split it into seperate events in  a way that we end up with:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 1&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {
        "container_id": "1",
        "executor_id": "1",
        "framework_id": "2",
        "statistics": {
          "cpus_limit": 1,
          "cpus_nr_periods": 1
        },
        "status": {
          "container_id": {
            "value": "123"
          }
        }
      }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Event 2&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
        "container_id": "2",
        "executor_id": "1",
        "framework_id": "3",
        "statistics": {
          "cpus_limit": 1.1,
          "cpus_nr_periods": 2
        },
        "status": {
          "container_id": {
            "value": "124"
          }
        }
      }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We can not do a split by '},' as this would also split on  &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;"cpus_nr_periods":  &lt;STRONG&gt;},&lt;/STRONG&gt; "status": {&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Is there any way we can split those events (on index time)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382402#M68935</guid>
      <dc:creator>sboogaar</dc:creator>
      <dc:date>2020-09-29T21:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Split json array of objects into multiple events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382403#M68936</link>
      <description>&lt;P&gt;Assuming your data isn't actually prettyprinted, you can have &lt;CODE&gt;LINE_BREAKER = \}(,)\{&lt;/CODE&gt; in your props.conf, alongside &lt;CODE&gt;SHOULD_LINEMERGE = false&lt;/CODE&gt;. If your data is prettyprinted you'll need to allow whitespace between the comma and the opening curly brace.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 23:14:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382403#M68936</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-11-12T23:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Split json array of objects into multiple events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382404#M68937</link>
      <description>&lt;P&gt;It is formatted exactly as I posted. I dont see how the linebreaker would work &lt;A href="https://regexr.com/43084"&gt;https://regexr.com/43084&lt;/A&gt;. We are not in control of the format as it is a response of a call to a DC/OS api&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 08:45:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382404#M68937</guid>
      <dc:creator>sboogaar</dc:creator>
      <dc:date>2018-11-13T08:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Split json array of objects into multiple events</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382405#M68938</link>
      <description>&lt;P&gt;If your data is prettyprinted you'll need to allow whitespace between the comma and the opening curly brace.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\}(,\s*)\{
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Nov 2018 09:09:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Split-json-array-of-objects-into-multiple-events/m-p/382405#M68938</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-11-13T09:09:00Z</dc:date>
    </item>
  </channel>
</rss>

