<?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: Create Pie Chart from JSON data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551696#M156555</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33185"&gt;@keiran_harris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ca you please share _raw and expected results in case of multiple event?&lt;/P&gt;</description>
    <pubDate>Sat, 15 May 2021 12:00:56 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2021-05-15T12:00:56Z</dc:date>
    <item>
      <title>Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551693#M156552</link>
      <description>&lt;P&gt;Hey Splunk Gurus!&amp;nbsp;&lt;/P&gt;&lt;P&gt;have been going in circles trying to get a query going to give me a pie chart on what I would have thought is relatively straightforward JSON data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heres what the JSON looks like. Id like the pie chart composed of all the pink arrow field values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20210515_20-37-52_Search  Splunk 8.0.3(2).jpg" style="width: 875px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14160i1E33B09D0B43B8FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="20210515_20-37-52_Search  Splunk 8.0.3(2).jpg" alt="20210515_20-37-52_Search  Splunk 8.0.3(2).jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone help?&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks so much!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Keiran.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 10:42:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551693#M156552</guid>
      <dc:creator>keiran_harris</dc:creator>
      <dc:date>2021-05-15T10:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551696#M156555</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33185"&gt;@keiran_harris&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ca you please share _raw and expected results in case of multiple event?&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 12:00:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551696#M156555</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-05-15T12:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551698#M156557</link>
      <description>&lt;P&gt;I have assumed for multiple events you want the sum of the AUD fields. (The first part before the blank lines just generates some sample data.)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="{
	\"BINNANCE-BALANCES\": {
		\"BTC\": {
			\"BTC-AUD\": 3,
			\"BTC-USDT\": 3
		},
		\"DOGE\": {
			\"DOGE-AUD\": 5,
			\"DOGE-USDT\": 4
		},
		\"ETC\": {
			\"ETC-AUD\": 7,
			\"ETC-USDT\": 5
		},
		\"ETH\": {
			\"ETH-AUD\": 9,
			\"ETH-USDT\": 6
		},
		\"HBAR\": {
			\"HBAR-AUD\": 1,
			\"HBAR-USDT\": 7
		}
	},
	\"BINNANCE-TALLY-ADD\": 20,
	\"kCryptoDictType\": \"BINNANCEbalances\"
}|{
	\"BINNANCE-BALANCES\": {
		\"BTC\": {
			\"BTC-AUD\": 1,
			\"BTC-USDT\": 3
		},
		\"DOGE\": {
			\"DOGE-AUD\": 2,
			\"DOGE-USDT\": 4
		},
		\"ETC\": {
			\"ETC-AUD\": 3,
			\"ETC-USDT\": 5
		},
		\"ETH\": {
			\"ETH-AUD\": 4,
			\"ETH-USDT\": 6
		},
		\"HBAR\": {
			\"HBAR-AUD\": 5,
			\"HBAR-USDT\": 7
		}
	},
	\"BINNANCE-TALLY-ADD\": 20,
	\"kCryptoDictType\": \"BINNANCEbalances\"
}"
| eval events=split(_raw,"|") 
| mvexpand events
| fields - _*
| rename events as _raw


| spath path=BINNANCE-BALANCES
| spath input=BINNANCE-BALANCES
| fields - _raw _time BINNANCE-BALANCES
| fields *-AUD
| stats sum(*) as *
| transpose 0&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 15 May 2021 12:34:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551698#M156557</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-15T12:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551721#M156565</link>
      <description>&lt;P&gt;Amazing. Thank you!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So, given i already have the JSON data streaming in, i assume then all i need is the below at the tail end of my search (and sorry, it was stupid of me not to give you guys text data, sorry for the work you had to replicate it manually from the screenshot - thanks for explaining that!).&lt;/P&gt;&lt;P&gt;re your assumption of “sum” i believe all i need actually is “last” . As in, my code (that spits out the JSON) is hitting an API that is like a balance. So im not interested in summing balanced over the search period, but rather just plotting the latest value that arrived to give me the latest balance. So in that case do i just replace “sum” in your second last line with “last”?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;finally, do i need the 4th last line (fields….) or is that a hangover of you having to work with my screenshot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;| spath path=BINNANCE-BALANCES
| spath input=BINNANCE-BALANCES
| fields - _raw _time BINNANCE-BALANCES
| fields *-AUD
| stats sum(*) as *
| transpose 0&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again. So impressed at turnaround time, esp on a weekend!&lt;/P&gt;&lt;P&gt;keiran.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 21:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551721#M156565</guid>
      <dc:creator>keiran_harris</dc:creator>
      <dc:date>2021-05-15T21:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551722#M156566</link>
      <description>&lt;P&gt;Yes, last instead of sum for your use case.&lt;/P&gt;&lt;P&gt;The transpose flips rows to columns so they appear as different series in the pie chart.&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 21:54:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551722#M156566</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-15T21:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551725#M156567</link>
      <description>&lt;P&gt;ok tried it, its darn close, but its duplicating that data set, at several levels of the JSON indenting. Any final tweaks? I can re-write my python code if needed to spit out the JSON with different names if that helps. It seems I might have to do that for the TALLY one (that also ends in -AUD) &amp;nbsp;Thanks again!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="keiran_harris_1-1621123880489.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14168iB8BA615866C1A7DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="keiran_harris_1-1621123880489.jpeg" alt="keiran_harris_1-1621123880489.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 00:15:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551725#M156567</guid>
      <dc:creator>keiran_harris</dc:creator>
      <dc:date>2021-05-16T00:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create Pie Chart from JSON data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551729#M156568</link>
      <description>&lt;P&gt;got there with fiddling! &amp;nbsp;thanks for setting me on the right path.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="keiran_harris_0-1621141447285.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14169i4572371595F153C3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="keiran_harris_0-1621141447285.jpeg" alt="keiran_harris_0-1621141447285.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 05:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-Pie-Chart-from-JSON-data/m-p/551729#M156568</guid>
      <dc:creator>keiran_harris</dc:creator>
      <dc:date>2021-05-16T05:04:19Z</dc:date>
    </item>
  </channel>
</rss>

