<?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: Apply spath automatically to a sourcetype with nested JSON in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407500#M72259</link>
    <description>&lt;P&gt;No, it is exactly what I want. I already have INDEXED_EXTRACTIONS. I can search first-level fields just fine. But some of these fields are of type JSON object. Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    {
      "field1": "stringValue",
      "field2": [
         {
             "field2_field1": 20
         }
      ]
     }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I search field2_field1 without doing &lt;CODE&gt;spath&lt;/CODE&gt;?&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jan 2019 22:47:07 GMT</pubDate>
    <dc:creator>Motoko89</dc:creator>
    <dc:date>2019-01-17T22:47:07Z</dc:date>
    <item>
      <title>Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407497#M72256</link>
      <description>&lt;P&gt;Hi all, I have JSON events with complex properties, aka nested JSON objects. I know how to apply &lt;CODE&gt;spath&lt;/CODE&gt; and create &lt;CODE&gt;macro&lt;/CODE&gt;. But I want to apply the macro automatically to the &lt;CODE&gt;sourcetype&lt;/CODE&gt;. Something similar to automatic lookup. How do I do this? Thanks,&lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
I already have INDEXED_EXTRACTIONS. I can search first-level fields just fine. But some of these fields are of type JSON object. Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    {
      "field1": "stringValue",
      "field2": [
         {
             "field2_field1": 20
         }
      ]
     }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I search &lt;CODE&gt;field2_field1&lt;/CODE&gt; value without doing &lt;CODE&gt;spath&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 23:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407497#M72256</guid>
      <dc:creator>Motoko89</dc:creator>
      <dc:date>2019-01-16T23:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407498#M72257</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Question title and descriptions bit misleading, please find below comment based on Question title &lt;STRONG&gt;Apply spath automatically to a sourcetype with nested JSON&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;If you only want to apply &lt;CODE&gt;spath&lt;/CODE&gt; to extract all fields from Nested JSON then I'll suggest to ingest data with JSON extractions.&lt;/P&gt;

&lt;P&gt;If you are forwarding data from Universal Forwarder then use below configurations on UF.&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
INDEXED_EXTRACTIONS = JSON
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jan 2019 10:19:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407498#M72257</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-17T10:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407499#M72258</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Please find the accepted answers in below link on splunk answers, this might help you:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/202023/is-it-possible-to-create-a-macro-to-do-this.html"&gt;https://answers.splunk.com/answers/202023/is-it-possible-to-create-a-macro-to-do-this.html&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 11:03:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407499#M72258</guid>
      <dc:creator>nikita_p</dc:creator>
      <dc:date>2019-01-17T11:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407500#M72259</link>
      <description>&lt;P&gt;No, it is exactly what I want. I already have INDEXED_EXTRACTIONS. I can search first-level fields just fine. But some of these fields are of type JSON object. Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    {
      "field1": "stringValue",
      "field2": [
         {
             "field2_field1": 20
         }
      ]
     }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I search field2_field1 without doing &lt;CODE&gt;spath&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407500#M72259</guid>
      <dc:creator>Motoko89</dc:creator>
      <dc:date>2019-01-17T22:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407501#M72260</link>
      <description>&lt;P&gt;Hi, I don't think it does. Please see my edit&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:52:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407501#M72260</guid>
      <dc:creator>Motoko89</dc:creator>
      <dc:date>2019-01-17T22:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407502#M72261</link>
      <description>&lt;P&gt;I have ingested above sample data in my lab environment with &lt;CODE&gt;INDEXED_EXTRACTIONS = JSON&lt;/CODE&gt; and it extracted nested JSON as well with field name &lt;CODE&gt;field2{}.field2_field1&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;To access this field easily for further usage in stats or any other command it will be good to rename it like &lt;CODE&gt;| rename field2{}.* as *&lt;/CODE&gt; and after that you will able to see field called &lt;CODE&gt;field2_field1&lt;/CODE&gt; in Interesting fields.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 09:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407502#M72261</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-18T09:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407503#M72262</link>
      <description>&lt;P&gt;Thanks! This works for me&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 22:30:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407503#M72262</guid>
      <dc:creator>Motoko89</dc:creator>
      <dc:date>2019-01-25T22:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Apply spath automatically to a sourcetype with nested JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407504#M72263</link>
      <description>&lt;P&gt;The other way is to props.conf on your search head(s) with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourcetypeHere]
KV_MODE = json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Jan 2019 18:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Apply-spath-automatically-to-a-sourcetype-with-nested-JSON/m-p/407504#M72263</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-26T18:30:36Z</dc:date>
    </item>
  </channel>
</rss>

