<?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: Extract JSON from log event in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326632#M60706</link>
    <description>&lt;P&gt;This did not work but your suggestion helped me modify my existing pattern.  &lt;CODE&gt;rex "(?&amp;lt;jsonData&amp;gt;{[^}].+})"&lt;/CODE&gt; works for me.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Mar 2018 17:41:14 GMT</pubDate>
    <dc:creator>splunk_skr</dc:creator>
    <dc:date>2018-03-01T17:41:14Z</dc:date>
    <item>
      <title>Extract JSON from log event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326630#M60704</link>
      <description>&lt;P&gt;Hi,  I am trying to come up with a REGEX that would give me the entire json from the log event. Here is how my log looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIMESTAMP  CHARS {
  "a": "1",
  "b": {
    "c": "2",
    "d": "3",
    "e": {
      "f": "4",
      "g": "5",
      "h": "6",
      "i": "7"
    },
    "j": "8",
    "k": "9"
  }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;REGEX i could come up with  &lt;CODE&gt;search  | rex "(?&amp;lt;jsonData&amp;gt;{[^}]+})" | spath input=jsonData&lt;/CODE&gt;  is removing all data after the first  } closes.  Any suggestions to fix this pls.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 17:15:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326630#M60704</guid>
      <dc:creator>splunk_skr</dc:creator>
      <dc:date>2018-03-01T17:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract JSON from log event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326631#M60705</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search | rex "^[^\{]+)(?m)(?&amp;lt;jsonData&amp;gt;.+)" | spath input=jsonData
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Mar 2018 17:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326631#M60705</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-03-01T17:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extract JSON from log event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326632#M60706</link>
      <description>&lt;P&gt;This did not work but your suggestion helped me modify my existing pattern.  &lt;CODE&gt;rex "(?&amp;lt;jsonData&amp;gt;{[^}].+})"&lt;/CODE&gt; works for me.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 17:41:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326632#M60706</guid>
      <dc:creator>splunk_skr</dc:creator>
      <dc:date>2018-03-01T17:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extract JSON from log event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326633#M60707</link>
      <description>&lt;P&gt;Does the search result have the fields available that are JSON hierarchically denoted? If not, it might not be viewing the data as JSON data. Your example has characters BEFORE the JSON string, which can cause the JSON parsing to not work. If Splunk is not viewing the data as JSON data, then that is your (first) problem. Remove the non-JSON string characters from the front of the event and it will likely work (no guarantees, as there could be some other problem, that that is a highly  likely cause of @somesoni2's suggestion not working).&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 20:10:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326633#M60707</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-03-01T20:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract JSON from log event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326634#M60708</link>
      <description>&lt;P&gt;I don't know about the original poster, but in my case, Cloudwatch is pre-pending data to what would otherwise be pure JSON. The characters BEFORE the string are not any content that we're specifically logging, they're a byproduct of the Cloudwatch log. &lt;/P&gt;

&lt;P&gt;Any suggestions on how to remove the non-JSON string characters from the front of an event logged via Cloudwatch?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 14:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-JSON-from-log-event/m-p/326634#M60708</guid>
      <dc:creator>jasongb</dc:creator>
      <dc:date>2018-10-24T14:29:25Z</dc:date>
    </item>
  </channel>
</rss>

