<?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 break events from JSON data. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165377#M46993</link>
    <description>&lt;P&gt;instead of using one or more space characters in your regex after the { character, try using a negative character class instead like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\,\s+\{[^\"]+\"id\"\:
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Aug 2015 20:38:17 GMT</pubDate>
    <dc:creator>tskinnerivsec</dc:creator>
    <dc:date>2015-08-13T20:38:17Z</dc:date>
    <item>
      <title>How to break events from JSON data.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165374#M46990</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have JSON data which I have to break into events. The data looks somewhat like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{    "data": [       {          "id": "X999_Y999",          "from": {             "name": "foo Brady", "id": "P12"         },          "message": "Looking forward to 2010!",          "actions": [             {                "name": "Comment",                "link": "http://www.facebook.com/X999/posts/Y999"            },             {                "name": "Like",                "link": "http://www.facebook.com/M999/posts/Z999"            }          ],          "type": "status",          "created_time": "2010-08-02T21:27:44+0000",          "updated_time": "2010-08-02T21:27:44+0000"      },       {          "id": "A998_Z998",          "from": {             "name": "foo Manning", "id": "P18"         },          "message": "Where's my contract?",          "actions": [             {                "name": "Comment",                "link": "http://www.facebook.com/X998/posts/Z998"            },             {                "name": "Like",                "link": "http://www.facebook.com/X998/posts/Z998"            }          ],          "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;I need to break this message into events at &lt;EM&gt;"id": "A998_Z998"&lt;/EM&gt;. That is- &lt;BR /&gt;
&lt;CODE&gt;},       {          "id":&lt;/CODE&gt;&lt;BR /&gt;
from this JSON message. I have tried the following for the props.conf-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BREAK_ONLY_BEFORE=,\s*{\s*"id":
INDEXED_EXTRACTIONS=json
KV_MODE=none
SHOULD_LINEMERGE=true
disabled=false
pulldown_type=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The JSON key value pairs are extracted, but I'm not able to break the JSON message into events at the required place. Can you please help me with this?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 05:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165374#M46990</guid>
      <dc:creator>shanksholla</dc:creator>
      <dc:date>2015-08-11T05:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to break events from JSON data.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165375#M46991</link>
      <description>&lt;P&gt;Did you try escaping some of the literal characters in your regex:  BREAK_ONLY_BEFORE=,s*{s*"id":   &lt;/P&gt;

&lt;P&gt;this should be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BREAK_ONLY_BEFORE = \,\s*\{\s*\"id\"\:
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;actually, I would also use \s+ instead of \s*, if you know that there will be at least one space character. The BREAK_ONLY_BEFORE directive&lt;BR /&gt;
specifies a regex pattern, what you had in your configuration example wasn't regex, it was just a string of literal characters. \s is a space character in regex, not s. This answer is assuming what is in your example is exactly what's in your props.conf config and splunk answers didn't strip out the escape characters out for you when you posted it.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:54:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165375#M46991</guid>
      <dc:creator>tskinnerivsec</dc:creator>
      <dc:date>2020-09-29T06:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to break events from JSON data.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165376#M46992</link>
      <description>&lt;P&gt;Sorry! There was a typo in props.conf properties I gave. I meant-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BREAK_ONLY_BEFORE=\,\s*\{\s*"id":
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I guess splunk answers stripped the escape characters. Basically I have used regex for white space.Hope BREAK_ONLY_BEFORE statement turned out right this time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
Also, as suggested have used s+ instead of s*. But no luck with the event split.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165376#M46992</guid>
      <dc:creator>shanksholla</dc:creator>
      <dc:date>2020-09-29T06:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to break events from JSON data.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165377#M46993</link>
      <description>&lt;P&gt;instead of using one or more space characters in your regex after the { character, try using a negative character class instead like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\,\s+\{[^\"]+\"id\"\:
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Aug 2015 20:38:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165377#M46993</guid>
      <dc:creator>tskinnerivsec</dc:creator>
      <dc:date>2015-08-13T20:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to break events from JSON data.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165378#M46994</link>
      <description>&lt;P&gt;Thanks for your reply. But this didn't work. Though all these regexes work fine in any regex tool, Splunk is not recognizing them. Basically, now all the data comes in one event.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2015 09:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165378#M46994</guid>
      <dc:creator>shanksholla</dc:creator>
      <dc:date>2015-08-17T09:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to break events from JSON data.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165379#M46995</link>
      <description>&lt;P&gt;did you try setting KV_MODE=json?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2015 21:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-break-events-from-JSON-data/m-p/165379#M46995</guid>
      <dc:creator>tskinnerivsec</dc:creator>
      <dc:date>2015-08-17T21:36:36Z</dc:date>
    </item>
  </channel>
</rss>

