<?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: Plotting bar chart X axis are JSON keys and Y axis are length of JSON values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560492#M159286</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;. That would work yes,&amp;nbsp; however, I need the search query to be dynamic because I don't know the keys ahead of time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any idea on how to do this?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 15:40:09 GMT</pubDate>
    <dc:creator>oKeNiDJE</dc:creator>
    <dc:date>2021-07-22T15:40:09Z</dc:date>
    <item>
      <title>Plotting bar chart X axis are JSON keys and Y axis are length of JSON values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560461#M159279</link>
      <description>&lt;P class="lia-align-left"&gt;Hi&lt;/P&gt;&lt;P class="lia-align-left"&gt;I have the following JSON object.&lt;/P&gt;&lt;P class="lia-align-left"&gt;I would like to be able to ultimately create a bar chart with the following:&lt;/P&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;X-Axis: Animal type ie dog, cat, chicken.....&lt;/P&gt;&lt;P class="lia-align-left"&gt;Y-Axis: The length of animal's array, this example, dog=2 cat=3 chicken=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
	"data": {
		"animals": {
			"dog": [{"name": "rex", "id": 1}, {"name": "tom", "id": 2}],
			"cat": [{"name": "rex", "id": 3}, {"name": "tom", "id": 4}, {"name": "sam", "id": 5}],
			"chicken": [{"name": "rex", "id": 6}]
		}
	}
}&lt;/LI-CODE&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;I'm new to Splunk so apologies but I'm not sure where to even begin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 11:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560461#M159279</guid>
      <dc:creator>oKeNiDJE</dc:creator>
      <dc:date>2021-07-22T11:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting bar chart X axis are JSON keys and Y axis are length of JSON values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560475#M159284</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236707"&gt;@oKeNiDJE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH 
| rex field=_raw "\"(?&amp;lt;animal&amp;gt;\w+)\":\s\[(?&amp;lt;arr&amp;gt;[^\]]*])" max_match=0
| eval t=mvzip(animal,arr,"|")
|stats count by t
| eval animal=mvindex(split(t,"|"),0),arr="[".mvindex(split(t,"|"),1) |fields - t, count
| rex field=arr "\"id\":\s(?&amp;lt;ids&amp;gt;\d)" max_match=0|eval count=mvcount(ids) 
| table animal count&lt;/LI-CODE&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;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="{\"data\": {\"animals\": {\"dog\": [{\"name\": \"rex\", \"id\": 1}, {\"name\": \"tom\", \"id\": 2}],\"cat\": [{\"name\": \"rex\", \"id\": 3}, {\"name\": \"tom\", \"id\": 4}, {\"name\": \"sam\", \"id\": 5}],\"chicken\": [{\"name\": \"rex\", \"id\": 6}]}}}" 
| rex field=_raw "\"(?&amp;lt;animal&amp;gt;\w+)\":\s\[(?&amp;lt;arr&amp;gt;[^\]]*])" max_match=0
| eval t=mvzip(animal,arr,"|")
|stats count by t
| eval animal=mvindex(split(t,"|"),0),arr="[".mvindex(split(t,"|"),1) |fields - t, count
| rex field=arr "\"id\":\s(?&amp;lt;ids&amp;gt;\d)" max_match=0|eval count=mvcount(ids) 
| table animal count&lt;/LI-CODE&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&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一 &amp;nbsp; ?&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 16:06:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560475#M159284</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-22T16:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting bar chart X axis are JSON keys and Y axis are length of JSON values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560492#M159286</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;. That would work yes,&amp;nbsp; however, I need the search query to be dynamic because I don't know the keys ahead of time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any idea on how to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 15:40:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560492#M159286</guid>
      <dc:creator>oKeNiDJE</dc:creator>
      <dc:date>2021-07-22T15:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting bar chart X axis are JSON keys and Y axis are length of JSON values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560501#M159288</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236707"&gt;@oKeNiDJE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have updated my answer. Can you please check it?&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 16:06:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560501#M159288</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-22T16:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting bar chart X axis are JSON keys and Y axis are length of JSON values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560536#M159295</link>
      <description>&lt;P&gt;This has been super helpful&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;! Thank you so much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say if you had a JSON object however and didn't want to convert it to a string and use rex, would that be possible?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 22:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560536#M159295</guid>
      <dc:creator>oKeNiDJE</dc:creator>
      <dc:date>2021-07-22T22:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting bar chart X axis are JSON keys and Y axis are length of JSON values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560556#M159306</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236707"&gt;@oKeNiDJE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That you need to POC and check&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;. &amp;nbsp;Coz, Splunk ingest characters / text format and if you ingest Json object then Splunk might be ingest represented value of that object and that might be invalid data for as.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Splunk need valid json string for auto discovery of fields.&lt;/P&gt;&lt;P&gt;So here I suggest keep it in converted string format and use rex for our requirements&amp;nbsp;.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一 &amp;nbsp; ?&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 04:34:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Plotting-bar-chart-X-axis-are-JSON-keys-and-Y-axis-are-length-of/m-p/560556#M159306</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-23T04:34:55Z</dc:date>
    </item>
  </channel>
</rss>

