<?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 plotting using data across multiple indexes in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128536#M44404</link>
    <description>&lt;P&gt;index=index1 | stats sum(feild1) as totalAmount1&lt;BR /&gt;
index=index 2| stats sum(feild2) as totalAmount2&lt;BR /&gt;
index=index 3| stats sum(feild3) as totalAmount3&lt;/P&gt;

&lt;P&gt;I need to display data from above 3 searches in the form of pie chart. Each pie section corresponds to each of the totals&lt;/P&gt;

&lt;P&gt;piechart=piesection1 should correspond to totalAmount1 + &lt;BR /&gt;
                 piesection2 should correspond to totalAmount2 +&lt;BR /&gt;
                 piesection3 should correspond to totalAmount3&lt;/P&gt;

&lt;P&gt;Can you please guide me as to how this can be performed.&lt;/P&gt;

&lt;P&gt;Please note the filed1,field2 &amp;amp; field3 are not common across indexes  each of those represent order amount for that index.&lt;/P&gt;

&lt;P&gt;Can you guide me as to how this can be achieved &lt;/P&gt;

&lt;P&gt;thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 06 Apr 2015 22:56:18 GMT</pubDate>
    <dc:creator>nekbote</dc:creator>
    <dc:date>2015-04-06T22:56:18Z</dc:date>
    <item>
      <title>plotting using data across multiple indexes</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128536#M44404</link>
      <description>&lt;P&gt;index=index1 | stats sum(feild1) as totalAmount1&lt;BR /&gt;
index=index 2| stats sum(feild2) as totalAmount2&lt;BR /&gt;
index=index 3| stats sum(feild3) as totalAmount3&lt;/P&gt;

&lt;P&gt;I need to display data from above 3 searches in the form of pie chart. Each pie section corresponds to each of the totals&lt;/P&gt;

&lt;P&gt;piechart=piesection1 should correspond to totalAmount1 + &lt;BR /&gt;
                 piesection2 should correspond to totalAmount2 +&lt;BR /&gt;
                 piesection3 should correspond to totalAmount3&lt;/P&gt;

&lt;P&gt;Can you please guide me as to how this can be performed.&lt;/P&gt;

&lt;P&gt;Please note the filed1,field2 &amp;amp; field3 are not common across indexes  each of those represent order amount for that index.&lt;/P&gt;

&lt;P&gt;Can you guide me as to how this can be achieved &lt;/P&gt;

&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2015 22:56:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128536#M44404</guid>
      <dc:creator>nekbote</dc:creator>
      <dc:date>2015-04-06T22:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: plotting using data across multiple indexes</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128537#M44405</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2 OR index=index3
| fields field1, field2, field3, index
| eval grouped_fields = coalesce(field1, field2, field3)
| chart sum(grouped_fields) by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then just go to the visualization drop down and select the pie. &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;So what's actually happening ? Rather than thinking about this as three seperate searches, we go ahead and specify all the indexes we might search for and all the fields we are interested in the first two lines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2 OR index=index3
| fields field1, field2, field3, index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next, we use eval to push all those fields into one field. Now this seems counterintuitive but the reason that it works is because we can still use their values for the &lt;CODE&gt;index&lt;/CODE&gt; field to keep them distinct. Grouping them together just allows us to push them all into the same &lt;CODE&gt;sum()&lt;/CODE&gt; function. &lt;CODE&gt;coalesce()&lt;/CODE&gt; here is taking any number of arguments and returning the whichever is not null.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval grouped_fields = coalesce(field1, field2, field3)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lastly, you can use &lt;CODE&gt;chart&lt;/CODE&gt; (or &lt;CODE&gt;stats&lt;/CODE&gt; if you want) to get the sum, splitting by index. One last thing you could do, would be &lt;CODE&gt;rename&lt;/CODE&gt; the indexes to what ever they might be representing.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2015 23:12:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128537#M44405</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-04-06T23:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: plotting using data across multiple indexes</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128538#M44406</link>
      <description>&lt;P&gt;@ aljohnson_splunk---Thanks alot for the quick response and it worked like a charm, i have been trying it out all day and your direction solved it in a minute...thank you again!!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2015 23:23:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/plotting-using-data-across-multiple-indexes/m-p/128538#M44406</guid>
      <dc:creator>nekbote</dc:creator>
      <dc:date>2015-04-06T23:23:46Z</dc:date>
    </item>
  </channel>
</rss>

