<?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 chart a search that returns event with multiple facets that have a name/result pair. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365698#M107839</link>
    <description>&lt;P&gt;have you tried &lt;CODE&gt;|spath&lt;/CODE&gt; &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2017 15:36:40 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-08-10T15:36:40Z</dc:date>
    <item>
      <title>How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365697#M107838</link>
      <description>&lt;P&gt;I am doing the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="new_relic_insights://NRInsightsAPI_rc_ShopFront_Top10Transactions"
| search *
| head 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns a single event, and within its facets I have a name: xyz and results.sum: 123&lt;/P&gt;

&lt;P&gt;The sum corresponds to the name, and I need to chart these on a bar chart.&lt;/P&gt;

&lt;P&gt;Here is an example of what is returned:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/Ja77fnQ.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Raw format:&lt;BR /&gt;
&lt;IMG src="http://i.imgur.com/9F6WRSo.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;This is what I have done so far to try to chart it, but because there are multiple values in one row, it doesn't work. Additionally the "total time" values aren't lined up with their corresponding result, for example 58245.xxx should be next to "WebTransaction/MVC/ProductController/Category" but it's not, again I assume this is because of them all being dumped into one row.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/7gwBvzG.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Finally, I tried dedup/table to get what I needed and the results.sum line up with each name, however again trying to graph this groups all the values of name as one since they are in one row.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/6OajMxo.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 14:28:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365697#M107838</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T14:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365698#M107839</link>
      <description>&lt;P&gt;have you tried &lt;CODE&gt;|spath&lt;/CODE&gt; &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 15:36:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365698#M107839</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T15:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365699#M107840</link>
      <description>&lt;P&gt;I tried to mess with it some but I've used splunk for all of 4 days and I've been working on this for maybe 10 hours now trying to fiddle with things. I have no clue how to use spath to fix this, I've tried extract too and am failing. If you can give some examples that would be great, because I've read docs on both commands and its not working the way I've tried it.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 15:43:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365699#M107840</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T15:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365700#M107841</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;source="new_relic_insights://NRInsightsAPI_rc_ShopFront_Top10Transactions"
| search *
| head 1
| spath input=name output="Transaction Name" path=facets{}.name
| spath input=sum output="Total Time" path=facets{}.results{}.sum
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This didn't seem to change anything at all, so I'm not really sure what I am doing with spath it seems.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 15:51:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365700#M107841</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T15:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365701#M107842</link>
      <description>&lt;P&gt;perhaps something like:&lt;BR /&gt;
    |spath|rename facets.name as name, facets.name.results.sum as sum|table facets sum&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 15:57:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365701#M107842</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T15:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365702#M107843</link>
      <description>&lt;P&gt;That gave me one row that looks like the last pic I showed using dedup.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:03:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365702#M107843</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T16:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365703#M107844</link>
      <description>&lt;P&gt;try using &lt;CODE&gt;|mvexpand name&lt;/CODE&gt; to make them separate rows, if the name and sum in each row match up to the raw data.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:11:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365703#M107844</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T16:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365704#M107845</link>
      <description>&lt;P&gt;This is what I got without mvexpand, highlight shows that the data was duplicated for some reason?&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/b12aClY.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;This is with mvexpand, data is duplicated in the right column, left column does split out the names at least!&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/dkyjZql.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365704#M107845</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T16:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365705#M107846</link>
      <description>&lt;P&gt;Playing with it a bit more, I got to this point which is almost perfect, except the sum is showing the first value for every row instead of iterating through the sum that correlates to the name.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/4N5RZ5c.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:29:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365705#M107846</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T16:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365706#M107847</link>
      <description>&lt;P&gt;Also, thanks for all your help so far! I figured out removing the |spath gets rid of duplicate sums.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 16:35:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365706#M107847</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T16:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365707#M107848</link>
      <description>&lt;P&gt;so what is your syntax now and are your results not bringing in the right sums still?&lt;/P&gt;

&lt;P&gt;if you did &lt;CODE&gt;|eval name_sum=mvzip(name,sum)|mvexpand name_sum|dedup name_sum&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 17:18:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365707#M107848</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T17:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365708#M107849</link>
      <description>&lt;P&gt;This is where I am now...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="new_relic_insights://NRInsightsAPI_rc_ShopFront_Top10Transactions"
| search *
| head 1
| rename facets{}.name as name, facets{}.results{}.sum as sum
| table name sum
| eval name_sum = mvzip(name, sum)
| mvexpand name_sum
| dedup name_sum
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/x9COuZl.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 17:26:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365708#M107849</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T17:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365709#M107850</link>
      <description>&lt;P&gt;so, i think that's looking pretty good. at the end add &lt;CODE&gt;|fields name_sum|rex field=name_sum "(?&amp;lt;name&amp;gt;\D+),(?&amp;lt;sum&amp;gt;.*)"|fields - name_sum&lt;/CODE&gt;&lt;BR /&gt;
that should split out name and sum back into two separate fields and display only them.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:06:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365709#M107850</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T18:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365710#M107851</link>
      <description>&lt;P&gt;Holy crap, it worked, thank you so much!&lt;/P&gt;

&lt;P&gt;One thing that would be nice but is REALLY one of those "sugar on top" things would be if we could represent the "sum" as a % of the sum of all the "sum" values.&lt;/P&gt;

&lt;P&gt;i.e. 55,737 / totalOfAllSum = x%&lt;/P&gt;

&lt;P&gt;Not completely necessary, but would help.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365710#M107851</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T18:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365711#M107852</link>
      <description>&lt;P&gt;to do that, add in &lt;CODE&gt;|eventstats sum(sum) as total|eval percent=round(sum/total*100,2)|fields - total&lt;/CODE&gt; to the end of the syntax. that should do it.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:15:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365711#M107852</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-08-10T18:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to chart a search that returns event with multiple facets that have a name/result pair.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365712#M107853</link>
      <description>&lt;P&gt;Perfect, thank you again!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:22:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-a-search-that-returns-event-with-multiple-facets/m-p/365712#M107853</guid>
      <dc:creator>WeiseGuy</dc:creator>
      <dc:date>2017-08-10T18:22:58Z</dc:date>
    </item>
  </channel>
</rss>

