<?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 create table using nested json? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610213#M212199</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;index=**** some search query |&amp;nbsp;&lt;BR /&gt;| rename status as STATUS |&amp;nbsp; spath path=data{} | mvexpand data{} | spath input=duration{} | chart values(duration) over STATUS by status&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sorry I didn't observe your sample data correctly. &amp;nbsp;You are correct that the path to the array is data{}, not duration{}. &amp;nbsp;As succh, in the next spath, input should also be data{}, not duration{}.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename status AS STATUS
| spath path=data{}
| mvexpand data{}
| spath input=data{}
| chart values(duration) over STATUS by status&lt;/LI-CODE&gt;&lt;P&gt;(As a side: If you are posting sample JSON, make sure the format is conformant. &amp;nbsp;I made the mistake when trying to correct the format.)&lt;/P&gt;</description>
    <pubDate>Sat, 20 Aug 2022 19:34:23 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-08-20T19:34:23Z</dc:date>
    <item>
      <title>How to create table using nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610122#M212162</link>
      <description>&lt;P&gt;Hi All I have a nested JSON in my log event. On that basis, I have to create a dynamic table.&lt;/P&gt;&lt;P&gt;{&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;status&lt;/SPAN&gt;:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;FINISHED&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;data&lt;/SPAN&gt;:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;duration&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;123&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;status&lt;/SPAN&gt;:&amp;nbsp;A&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;duration&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;456&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;status&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;B&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;duration&lt;/SPAN&gt;:&amp;nbsp;&lt;SPAN class=""&gt;678&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;status&lt;/SPAN&gt;:C&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;I need to create the table for this nested one&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table Structure&lt;/STRONG&gt; :&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;status&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;B&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;Finished&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;123&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;456&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;678&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Also, I have one more req. If in the future we get more values in the sub-part of JSON then can we add a column for that also&lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 18:32:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610122#M212162</guid>
      <dc:creator>bharat149</dc:creator>
      <dc:date>2022-08-20T18:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create table using nested json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610131#M212164</link>
      <description>&lt;P&gt;I think a kvstore with json should do be what you want.. you can use collections.conf or the lookup file editor to define the non-json elements and type, and one for the array - then I would call them out explicitly in the transforms.conf file so you can play nicely with them using lookup and inputlookup&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;The structure you settle on will depend on how you analyze this going forward, but I'd be tempted to start with this (you can view it in &lt;A href="https://jsongrid.com/json-grid" target="_blank"&gt;https://jsongrid.com/json-grid&lt;/A&gt;)&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;"status": "finished",&lt;BR /&gt;"duration_array": [&lt;BR /&gt;{&lt;BR /&gt;"status": "A",&lt;BR /&gt;"duration": 123&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"status": "B",&lt;BR /&gt;"duration": 456&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"status": "C",&lt;BR /&gt;"duration": 678&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;To use kvstore, you can define using the collections.conf, and lookup editor or the lookup file editor iin cloud&lt;BR /&gt;&lt;BR /&gt;I prefer using the structure I have suggested as you can easily insert new status values,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="donelliot_0-1660917487214.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21103i6ADD885CEFF7630C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="donelliot_0-1660917487214.png" alt="donelliot_0-1660917487214.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="donelliot_1-1660917487282.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21104iF9B58DCAC8942828/image-size/medium?v=v2&amp;amp;px=400" role="button" title="donelliot_1-1660917487282.png" alt="donelliot_1-1660917487282.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;becomes&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="donelliot_2-1660917540583.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21105i835E6DF56F33EDC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="donelliot_2-1660917540583.png" alt="donelliot_2-1660917540583.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You should be able to refer to the data elements and do whatever you want - unless i'm missing the point&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 13:59:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610131#M212164</guid>
      <dc:creator>donelliot</dc:creator>
      <dc:date>2022-08-19T13:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create table using nested json</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610197#M212189</link>
      <description>&lt;P&gt;I want splunk query for this&lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 07:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610197#M212189</guid>
      <dc:creator>bharat149</dc:creator>
      <dc:date>2022-08-20T07:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table using nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610199#M212191</link>
      <description>&lt;P&gt;Assuming that nested JSON is the raw event, you can use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename status AS STATUS ``` cope with name collision ```
| spath path=duration{}
| mvexpand duration{}
| spath input=duration{}
| chart values(duration) over STATUS by status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 07:45:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610199#M212191</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-20T07:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table using nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610211#M212197</link>
      <description>&lt;P&gt;Hi, I have updated the duration name since it appears twice.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;index=**** some search query |&amp;nbsp;&lt;BR /&gt;| rename status as STATUS |&amp;nbsp; spath path=data{} | mvexpand data{} | spath input=duration{} | chart values(duration) over STATUS by status&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After running this query I am getting no result&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-08-21 at 12.05.24 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21109iD87E4A3910157E13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2022-08-21 at 12.05.24 AM.png" alt="Screenshot 2022-08-21 at 12.05.24 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 18:35:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610211#M212197</guid>
      <dc:creator>bharat149</dc:creator>
      <dc:date>2022-08-20T18:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create table using nested json?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610213#M212199</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;index=**** some search query |&amp;nbsp;&lt;BR /&gt;| rename status as STATUS |&amp;nbsp; spath path=data{} | mvexpand data{} | spath input=duration{} | chart values(duration) over STATUS by status&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sorry I didn't observe your sample data correctly. &amp;nbsp;You are correct that the path to the array is data{}, not duration{}. &amp;nbsp;As succh, in the next spath, input should also be data{}, not duration{}.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename status AS STATUS
| spath path=data{}
| mvexpand data{}
| spath input=data{}
| chart values(duration) over STATUS by status&lt;/LI-CODE&gt;&lt;P&gt;(As a side: If you are posting sample JSON, make sure the format is conformant. &amp;nbsp;I made the mistake when trying to correct the format.)&lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 19:34:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-table-using-nested-json/m-p/610213#M212199</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-20T19:34:23Z</dc:date>
    </item>
  </channel>
</rss>

