<?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 to split JSON array element into different events using props.conf in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192667#M38422</link>
    <description>&lt;P&gt;Can you please tell me how to parse before indexing. Is it using transforms.conf?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2015 11:33:38 GMT</pubDate>
    <dc:creator>shanksholla</dc:creator>
    <dc:date>2015-08-27T11:33:38Z</dc:date>
    <item>
      <title>How to split JSON array element into different events using props.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192663#M38418</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have a JSON message which looks like-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "data": [
        {
            "id": "X999_Y999",
            "from": {
                "name": "Tom Brady",
                "id": "X12"
            },
            "message": "Looking forward to 2010!",
            "actions": [
                {
                    "name": "Comment",
                    "link": "http://www.facebook.com/X999/posts/Y999"
                },
                {
                    "name": "Like",
                    "link": "http://www.facebook.com/X999/posts/Y999"
                }
            ],
            "type": "status",
            "created_time": "2010-08-02T21:27:44+0000",
            "updated_time": "2010-08-02T21:27:44+0000"
        },
        {
            "id": "X998_Y998",
            "from": {
                "name": "Peyton Manning",
                "id": "X18"
            },
            "message": "Where's my contract?",
            "actions": [
                {
                    "name": "Comment",
                    "link": "http://www.facebook.com/X998/posts/Y998"
                },
                {
                    "name": "Like",
                    "link": "http://www.facebook.com/X998/posts/Y998"
                }
            ],
            "type": "status",
            "created_time": "2010-08-02T21:27:44+0000",
            "updated_time": "2010-08-02T21:27:44+0000"
        }
    ]
} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, I would want to split this JSON array into different events. In this message, data from-&lt;BR /&gt;
 &lt;CODE&gt;{&lt;BR /&gt;
             "id": "",&lt;/CODE&gt;&lt;BR /&gt;
onwards would constitute different messages.&lt;/P&gt;

&lt;P&gt;I have tried the following in props.conf, but all the data are shows up as single event.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ json_split ]
TIME_FORMAT=%Y-%m-%dT%H:%M:%S+%4N
TIME_PREFIX="updated_time":\s"
SHOULD_LINEMERGE=true
BREAK_ONLY_BEFORE=(\{\s+"id")
NO_BINARY_CHECK=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you please tell how to split this JSON array into different events.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2015 12:34:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192663#M38418</guid>
      <dc:creator>shanksholla</dc:creator>
      <dc:date>2015-08-25T12:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to split JSON array element into different events using props.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192664#M38419</link>
      <description>&lt;HR /&gt;

&lt;HR /&gt;

&lt;HR /&gt;

&lt;P&gt;For your sample data, I changed &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BREAK_ONLY_BEFORE="id":\s".*?",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and it worked - its not very robust however - if you ever have a field that comes after "id" in the "from" node, it will break.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2015 12:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192664#M38419</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-08-25T12:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to split JSON array element into different events using props.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192665#M38420</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;BR /&gt;
But with this, the leading curly braces (prior to "id") is left in previous event. &lt;BR /&gt;
Also with this, it wouldn't be possible to parse the data in events into key value pairs using INDEXED_EXTRACTIONS or KV_MODE.&lt;BR /&gt;
Please correct me if I'm wrong&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:07:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192665#M38420</guid>
      <dc:creator>shanksholla</dc:creator>
      <dc:date>2020-09-29T07:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to split JSON array element into different events using props.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192666#M38421</link>
      <description>&lt;P&gt;Hmm. I see what your saying. I'm guessing it would be easier to either use LINE_BREAKER and turn SHOULD_LINEMERGE to false. I'll give it another go and see if I can come up with a better solution.&lt;/P&gt;

&lt;P&gt;Could you maybe parse the events before indexing - it might be easier &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:04:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192666#M38421</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2020-09-29T07:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to split JSON array element into different events using props.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192667#M38422</link>
      <description>&lt;P&gt;Can you please tell me how to parse before indexing. Is it using transforms.conf?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2015 11:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-split-JSON-array-element-into-different-events-using/m-p/192667#M38422</guid>
      <dc:creator>shanksholla</dc:creator>
      <dc:date>2015-08-27T11:33:38Z</dc:date>
    </item>
  </channel>
</rss>

