<?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: Get multiple name/value from JSON file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535906#M151486</link>
    <description>&lt;P&gt;Where does&amp;nbsp;&lt;SPAN&gt;GarageDesc come from? It isn't shown in your JSON image.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jan 2021 20:36:02 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-01-14T20:36:02Z</dc:date>
    <item>
      <title>Get multiple name/value from JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535865#M151474</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I've been trying several day to create a query that can give me the list of name/value&amp;nbsp; inside the JSON file&lt;/P&gt;&lt;P&gt;the file has hundreds of event and each event has multiple name/value as the picture below&lt;/P&gt;&lt;P&gt;I'm not able to create a table out of the name/value pair from each event as below&lt;/P&gt;&lt;P&gt;can anyone help me or guide me in the right direction ?&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;GarageId&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;GarageClassId&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;GarageTypeId&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;3&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;6&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;5&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 632px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12548iEA5280F59B576675/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;thanks a lot for your time and support&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;&lt;SPAN class="key level-1"&gt;&lt;SPAN class="key level-3"&gt;&lt;SPAN class="key level-5"&gt;&lt;SPAN class="key level-7"&gt;&lt;SPAN class="t null"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 15:54:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535865#M151474</guid>
      <dc:creator>abilis</dc:creator>
      <dc:date>2021-01-14T15:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get multiple name/value from JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535887#M151484</link>
      <description>&lt;P&gt;Here is a starting point&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="{ \"Locking\": \"blah\",
  \"accessDate\": \"blah, blah\",
  \"auditResultSets\": [
    { \"action\": \"U\",
	  \"commandType\": 0,
	  \"records\": [
	    { \"newValues\": [
		  { \"name\": \"GarageId\",
		    \"value\": 4
		  },
		  { \"name\": \"GarageClassId\",
		    \"value\": 1
		  },
		  { \"name\": \"GarageTypeId\",
		    \"value\": 5
		  }
		  ],
		  \"OriginalValues\": [
		  { \"name\": \"GarageId\",
		    \"value\": 4
		  },
		  { \"name\": \"GarageClassId\",
		    \"value\": 2
		  },
		  { \"name\": \"GarageTypeId\",
		    \"value\": 4
		  }
		  ]
		}
		]
	}
	]
}"
| spath input=_raw path=auditResultSets{}.records{}.newValues{}
| fields - _raw
| rename "auditResultSets{}.records{}.newValues{}" as newValues
| mvexpand newValues
| spath input=newValues
| eval namevalue=mvzip(name, value, ":")
| fields - _time name value
| mvexpand namevalue
| rex field=namevalue "(?&amp;lt;name&amp;gt;[^:]+):(?&amp;lt;value&amp;gt;.+)"
| fields - namevalue
| eval {name}=value
| fields - name value newValues
| stats values(*) as *&lt;/LI-CODE&gt;&lt;P&gt;Obvious issues are that the stats should probably include a by clause so that each row represents the values from a defined newValues collection, and, it only works for newValues (not OriginalValues as well), but it does demonstrate the principal of creating dynamically named fields with their values.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 17:48:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535887#M151484</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-01-14T17:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get multiple name/value from JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535902#M151485</link>
      <description>&lt;P&gt;wow, thanks a lot... i worked on it several&amp;nbsp; days and still i was far from getting something like this.&lt;/P&gt;&lt;P&gt;i added the this at the end&amp;nbsp;&lt;/P&gt;&lt;P&gt;| stats values(GarageDesc) as Description by GarageId&lt;/P&gt;&lt;P&gt;GarageId Description&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="751px"&gt;3&lt;/TD&gt;&lt;TD width="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="751px"&gt;4&lt;/TD&gt;&lt;TD width="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am not getting the GarageDesc, it seems lke if the GarageID where no associated to the values of GarageDesc&lt;/P&gt;&lt;P&gt;i am looking to&amp;nbsp; get the multiple&amp;nbsp;GarageDesc values (one value per event)&amp;nbsp; of all the events with specific GarageId&lt;/P&gt;&lt;P&gt;i had this before but i seem to have same issue&lt;/P&gt;&lt;P&gt;spath path=auditResultSets{}.records{}.newValues{}.name output=fieldId&lt;BR /&gt;| spath path=auditResultSets{}.records{}.newValues{}.value output=value&lt;BR /&gt;| eval fieldValue=mvzip(fieldId,value)&lt;BR /&gt;| mvexpand fieldValue&lt;BR /&gt;| eval fieldValue=split(fieldValue,",")&lt;BR /&gt;| eval fieldId=mvindex(fieldValue,0)&lt;BR /&gt;| eval value=mvindex(fieldValue,1)&lt;BR /&gt;| table fieldId value&lt;/P&gt;&lt;P&gt;thanks for your time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 20:13:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535902#M151485</guid>
      <dc:creator>abilis</dc:creator>
      <dc:date>2021-01-14T20:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get multiple name/value from JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535906#M151486</link>
      <description>&lt;P&gt;Where does&amp;nbsp;&lt;SPAN&gt;GarageDesc come from? It isn't shown in your JSON image.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 20:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535906#M151486</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-01-14T20:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get multiple name/value from JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535914#M151487</link>
      <description>&lt;P&gt;sorry, you are right.&lt;/P&gt;&lt;P&gt;it's just another key like GarageTypeId, but i have in another JSON file.&lt;/P&gt;&lt;P&gt;please ignore the GarageDesc,&amp;nbsp; let's use GarageTypeId&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 20:56:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-multiple-name-value-from-JSON-file/m-p/535914#M151487</guid>
      <dc:creator>abilis</dc:creator>
      <dc:date>2021-01-14T20:56:55Z</dc:date>
    </item>
  </channel>
</rss>

