<?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: Top to a sum in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77511#M19581</link>
    <description>&lt;P&gt;"Others" is displayed if I assume it "useother=true". However, I think that this isn't the result that you expect.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEARCH | stats sum(MB) AS SumMB by service | top SumMB useother=true otherstr="Others"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think that it is necessary to calculate percent by oneself.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;For example&lt;/EM&gt;&lt;BR /&gt;
SEARCH | stats sum(MB) AS SumMB by service |sort - SumMB|eval id=1|accum id|eval Service=if(id&amp;lt;=4,service,"OTHER")|stats sum(SumMB) as SumMB by Service|addcoltotals labelfield=Service label=ALL|sort - SumMB|eval Total=IF(Service="ALL",SumMB,0)|accum Total|WHERE Service!="ALL"|eval percent=SumMB/Total*100|fields - Total&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;comment&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;|sort - SumMB|eval id=1|accum id|eval Service=if(id&amp;lt;=4,service,"OTHER")|&lt;STRONG&gt;-&amp;gt;extract TOP4 and "OTHER"&lt;/STRONG&gt;&lt;BR /&gt;
|addcoltotals labelfield=Service label=ALL|sort - SumMB|eval Total=IF(Service="ALL",SumMB,0)|accum Total|WHERE Service!="ALL"|&lt;STRONG&gt;-&amp;gt;Calculation of the total&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;When there is little number, you may demand total by a subsearch.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2013 05:07:23 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2013-10-01T05:07:23Z</dc:date>
    <item>
      <title>Top to a sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77508#M19578</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;
I try to make the sum of a field, but then need to get the percentage occupied by each of the first 4, and% occupying all others, ie get something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;**Service**    **SumMB**        **percent**
  HHTP            90               25.71
  HTTPS           85               22.45
  DNS             81               21.09
  SMTP            70               16.90
  Otros           23               13.85
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried something like this, but that would be missing something but, as you could?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEARCH | stats sum(MB) AS SumMB by service | top SumMB otherstr="Others"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you for your attention.&lt;BR /&gt;
:)&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 00:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77508#M19578</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2013-10-01T00:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Top to a sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77509#M19579</link>
      <description>&lt;P&gt;In your question you ask for the sum of the first 4 with a percent, and then a percent of the others, but in your example you show the sum and percent for all 5.  Your goal is not clear.&lt;BR /&gt;
The question: "I tried something like this, but that would be missing something but, as you could?" does not compute.  Can you review this question, please.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 01:13:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77509#M19579</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-10-01T01:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Top to a sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77510#M19580</link>
      <description>&lt;P&gt;Sorry for the confusion, but the result I'm trying to get is the one show as a table. I hope you understand.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 01:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77510#M19580</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2013-10-01T01:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Top to a sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77511#M19581</link>
      <description>&lt;P&gt;"Others" is displayed if I assume it "useother=true". However, I think that this isn't the result that you expect.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEARCH | stats sum(MB) AS SumMB by service | top SumMB useother=true otherstr="Others"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think that it is necessary to calculate percent by oneself.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;For example&lt;/EM&gt;&lt;BR /&gt;
SEARCH | stats sum(MB) AS SumMB by service |sort - SumMB|eval id=1|accum id|eval Service=if(id&amp;lt;=4,service,"OTHER")|stats sum(SumMB) as SumMB by Service|addcoltotals labelfield=Service label=ALL|sort - SumMB|eval Total=IF(Service="ALL",SumMB,0)|accum Total|WHERE Service!="ALL"|eval percent=SumMB/Total*100|fields - Total&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;comment&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;|sort - SumMB|eval id=1|accum id|eval Service=if(id&amp;lt;=4,service,"OTHER")|&lt;STRONG&gt;-&amp;gt;extract TOP4 and "OTHER"&lt;/STRONG&gt;&lt;BR /&gt;
|addcoltotals labelfield=Service label=ALL|sort - SumMB|eval Total=IF(Service="ALL",SumMB,0)|accum Total|WHERE Service!="ALL"|&lt;STRONG&gt;-&amp;gt;Calculation of the total&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;When there is little number, you may demand total by a subsearch.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 05:07:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77511#M19581</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2013-10-01T05:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Top to a sum</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77512#M19582</link>
      <description>&lt;P&gt;Your response and your logic are excellent!&lt;BR /&gt;
Thank you very much HiroshiSatoh!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 18:05:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Top-to-a-sum/m-p/77512#M19582</guid>
      <dc:creator>jrodriguezap</dc:creator>
      <dc:date>2013-10-01T18:05:16Z</dc:date>
    </item>
  </channel>
</rss>

