<?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 can we extract a json document within an event? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302237#M57079</link>
    <description>&lt;P&gt;ddrillic - You can index just the json portion of the event, but it looks like the text before the json portion includes timestamp, etc. Since this log is not proper json, I think you're going to need to do regex on it for display purposes.&lt;/P&gt;

&lt;P&gt;When looking at xml or json data (assuming it conforms to standards - sorry not exactly sure what that all entails:)), you can use kvmode=xml or json, or use something like the above. My skills are really around getting data in, and not SPL proper (I know, I know:)), so I will defer to the SPL experts for the spl-specific questions, but my focus is really on making sure data comes in correctly, so the SPL doesn't need to be complex to get value out of the data. Sorry if that doesnt help.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2017 14:08:20 GMT</pubDate>
    <dc:creator>sshelly_splunk</dc:creator>
    <dc:date>2017-10-12T14:08:20Z</dc:date>
    <item>
      <title>How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302227#M57069</link>
      <description>&lt;P&gt;We have events such as - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10.10.2017 09:40:39.651 *INFO* [10.86.208.119 [1507646439651] POST /apps/xxxx/yyyy HTTP/1.1] com.xxxx.yyyy.api.impl.logging.info.InfoLoggerServiceImpl {"id":{"access_token":"7ee2ea18-e72c-449d-9dec-28d02b116c92","uid":"zzzzz","jsessionID":"aaaaaaa","uuid":"12e255ac-35e9-4630-a36b-89aa27e9566e"},"request":{"url":"https://bbb.cccc.com/content/uuuuuu"..... }]}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The json document is part of the event. Can we extract this json document?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 14:51:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302227#M57069</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-10T14:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302228#M57070</link>
      <description>&lt;P&gt;I took a quick look at this, and I think this transforms might work for you. This will not get the "id" or "request" fields, as I am not sure what they are. This did get the following: access_token, uid, jsessionID, uuid and url. &lt;BR /&gt;
In props, I added: REPORT-extract = json_embedded&lt;BR /&gt;
The transforms stanza is: &lt;BR /&gt;
    [json_embedded]&lt;BR /&gt;
    REGEX = "(\w+)"."(\S+?)"&lt;BR /&gt;
    FORMAT = $1::$2&lt;/P&gt;

&lt;P&gt;Hope this helps. Reply if it does not.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302228#M57070</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2020-09-29T16:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302229#M57071</link>
      <description>&lt;P&gt;Beautiful thing!!! I wanted to ask for a while - is there a way to test these configurations somehow from the search interface before adding these configurations to the config files?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 15:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302229#M57071</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-10T15:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302230#M57072</link>
      <description>&lt;P&gt;&lt;A href="https://regex101.com/r/FPxKuU/1"&gt;https://regex101.com/r/FPxKuU/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;P&gt;| makeresults | eval test="10.10.2017 09:40:39.651 &lt;EM&gt;INFO&lt;/EM&gt; [10.86.208.119 [1507646439651] POST /apps/xxxx/yyyy HTTP/1.1] com.xxxx.yyyy.api.impl.logging.info.InfoLoggerServiceImpl {\"id\":{\"access_token\":\"7ee2ea18-e72c-449d-9dec-28d02b116c92\",\"uid\":\"zzzzz\",\"jsessionID\":\"aaaaaaa\",\"uuid\":\"12e255ac-35e9-4630-a36b-89aa27e9566e\"},\"request\":{\"url\":\"&lt;A href="https://bbb.cccc.com/content/uuuuuu%5C"&gt;https://bbb.cccc.com/content/uuuuuu\&lt;/A&gt;"..... }]}}" | rex field=test "(?P\"(\w+)\".\"(\S+))\""&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:06:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302230#M57072</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-10-10T16:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302231#M57073</link>
      <description>&lt;P&gt;Wow - man. very pretty!!!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:08:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302231#M57073</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-10T16:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302232#M57074</link>
      <description>&lt;P&gt;I use regex101 to test all of my transforms (unless they are extremely simple:)). &lt;BR /&gt;
Copy 2 events if available into the "Test String" window, and go to town.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302232#M57074</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2017-10-10T16:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302233#M57075</link>
      <description>&lt;P&gt;sorry - just re-read your question. I test regex in the search bar sometimes, but not usually. Slightly different format, etc, so I use regex101, but might be just a preference.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302233#M57075</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2017-10-10T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302234#M57076</link>
      <description>&lt;P&gt;Perfect,  so I got the &lt;CODE&gt;REGEX&lt;/CODE&gt; part. What does the &lt;CODE&gt;FORMAT&lt;/CODE&gt; - &lt;CODE&gt;$1::$2&lt;/CODE&gt; mean?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 16:19:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302234#M57076</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-10T16:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302235#M57077</link>
      <description>&lt;P&gt;You could take a raw copy of the logs and use the UI to upload and test the event breaking and extraction. I think Splunk really likes Json since it auto extracts the fields and values. &lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 17:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302235#M57077</guid>
      <dc:creator>blacknight659</dc:creator>
      <dc:date>2017-10-10T17:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302236#M57078</link>
      <description>&lt;P&gt;Just applied it and it works perfectly - much appreciated. Just wondering if there is anything like the &lt;CODE&gt;spath&lt;/CODE&gt; command that we use for XML documents for json documents, so we can reach nested elements ... &lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 22:03:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302236#M57078</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-11T22:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302237#M57079</link>
      <description>&lt;P&gt;ddrillic - You can index just the json portion of the event, but it looks like the text before the json portion includes timestamp, etc. Since this log is not proper json, I think you're going to need to do regex on it for display purposes.&lt;/P&gt;

&lt;P&gt;When looking at xml or json data (assuming it conforms to standards - sorry not exactly sure what that all entails:)), you can use kvmode=xml or json, or use something like the above. My skills are really around getting data in, and not SPL proper (I know, I know:)), so I will defer to the SPL experts for the spl-specific questions, but my focus is really on making sure data comes in correctly, so the SPL doesn't need to be complex to get value out of the data. Sorry if that doesnt help.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 14:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302237#M57079</guid>
      <dc:creator>sshelly_splunk</dc:creator>
      <dc:date>2017-10-12T14:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302238#M57080</link>
      <description>&lt;P&gt;Very interesting, so you are saying that if it's a "real" json document we can parse it as such - interesting.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 15:23:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302238#M57080</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-13T15:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can we extract a json document within an event?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302239#M57081</link>
      <description>&lt;P&gt;For future reference -&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;FORMAT = $1::$2&lt;/CODE&gt; (where the REGEX extracts both the field name and the field value)&lt;/P&gt;

&lt;P&gt;from &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/Data/Configureindex-timefieldextraction"&gt;Create custom fields at index time&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 23:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-we-extract-a-json-document-within-an-event/m-p/302239#M57081</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-10-16T23:11:33Z</dc:date>
    </item>
  </channel>
</rss>

