<?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 get 1st 2nd and 3rd place results? - based on value of a field - not frequency. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177257#M186749</link>
    <description>&lt;P&gt;Another solution my be something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    base search | 
    sort server, -value |
    streamstats count as rank by server |
    where rank &amp;lt; 3 |
    table server counter value rank
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't have sufficient data to run a meaningful comparison of the different methods, so don't know which is more performs better over a large dataset.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Oct 2014 13:44:59 GMT</pubDate>
    <dc:creator>dave_vgc</dc:creator>
    <dc:date>2014-10-31T13:44:59Z</dc:date>
    <item>
      <title>how to get 1st 2nd and 3rd place results? - based on value of a field - not frequency.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177252#M186744</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;can anyone help me change this MSSQL type problem, into something i can get from Splunk! :&lt;/P&gt;

&lt;P&gt;if i have a table (Data) containing:&lt;/P&gt;

&lt;P&gt;Server   Counter               Value&lt;BR /&gt;
1              1                              1&lt;BR /&gt;
1              2                              2&lt;BR /&gt;
1              3                              3&lt;BR /&gt;
2              1                              3&lt;BR /&gt;
2              2                              4&lt;BR /&gt;
2              3                              7&lt;BR /&gt;
3              1                              18&lt;BR /&gt;
3              2                              0&lt;BR /&gt;
3              3                              2&lt;/P&gt;

&lt;P&gt;In MSSQL i would write:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;SELECT *&lt;BR /&gt;
FROM (&lt;BR /&gt;
                SELECT *&lt;BR /&gt;
                                ,RN = ROW_NUMBER() OVER (PARTITION BY Counter ORDER BY Value DESC)&lt;BR /&gt;
                FROM #DATA&lt;BR /&gt;
) a&lt;BR /&gt;
WHERE RN&amp;lt;=2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;RESULT:&lt;BR /&gt;
Server   Counter               Value    RN&lt;BR /&gt;
3              1                              18           1&lt;BR /&gt;
2              1                              3              2&lt;BR /&gt;
2              2                              4              1&lt;BR /&gt;
1              2                              2              2&lt;BR /&gt;
1              3                              3              2&lt;BR /&gt;
2              3                              7              1&lt;/P&gt;

&lt;P&gt;Note - this only gives the first and second place - but the methodology is what i was showing. I can't find anything that allows groups and subsets of results to be returned from a search.&lt;/P&gt;

&lt;P&gt;I'm not getting this data from SQL - it's just the only way i could think of to illustrate the problem. I'm looking to get a subset of perfmon values out of Splunk! based on what may be considered "badly performing machines" eg - 10 highest CPU percentages ,5 highest Disk Queues etc.&lt;/P&gt;

&lt;P&gt;I'd prefer not to have to write separate searches for each counter also&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Colin&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 12:21:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177252#M186744</guid>
      <dc:creator>colineltringham</dc:creator>
      <dc:date>2014-10-30T12:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to get 1st 2nd and 3rd place results? - based on value of a field - not frequency.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177253#M186745</link>
      <description>&lt;P&gt;Hello ,&lt;BR /&gt;
If you are looking for getting the high values or want to group them to find out the machines there are several ways to do it.&lt;/P&gt;

&lt;P&gt;1st: This will give you the values with their counts and percentage in the whole dataset&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source=CPU counter="% Proccessor Time" instance=_Total|top 5 Value by host&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;2nd: Use stats to get the values over a period of time&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source=CPU counter="% Proccessor Time" instance=_Total|stats avg(Value) as Usage by host|sort 5 -Value, host&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;3rd: Use timechart to get the trend&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source=CPU counter="% Proccessor Time" instance=_Total|timechart avg(Value) by host&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
L&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 12:40:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177253#M186745</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-10-30T12:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to get 1st 2nd and 3rd place results? - based on value of a field - not frequency.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177254#M186746</link>
      <description>&lt;P&gt;@colineltringham focus on the last pipe of @linu1988's 2nd answer. Using the "sort" command with a numeric value specifies how many results you want after the sort occurs. That should be exactly what you are looking for.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 12:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177254#M186746</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-10-30T12:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to get 1st 2nd and 3rd place results? - based on value of a field - not frequency.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177255#M186747</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Thanks for the suggestions, but it's not quite what i am after as it will only return 5 results total (the sort part). I'm after the 5 max values of each subset of data, similar to the results i listed in the SQL version of the problem, where i returned 2 values for each counter when there were 3 values for each in the source.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Colin&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 13:12:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177255#M186747</guid>
      <dc:creator>colineltringham</dc:creator>
      <dc:date>2014-10-30T13:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to get 1st 2nd and 3rd place results? - based on value of a field - not frequency.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177256#M186748</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I think i've found my own anser:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;base search | dedup 5 object counter instance sortby object counter instance -Value&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;this gives 5 results per combination.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Colin&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2014 14:45:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177256#M186748</guid>
      <dc:creator>colineltringham</dc:creator>
      <dc:date>2014-10-30T14:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to get 1st 2nd and 3rd place results? - based on value of a field - not frequency.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177257#M186749</link>
      <description>&lt;P&gt;Another solution my be something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    base search | 
    sort server, -value |
    streamstats count as rank by server |
    where rank &amp;lt; 3 |
    table server counter value rank
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't have sufficient data to run a meaningful comparison of the different methods, so don't know which is more performs better over a large dataset.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2014 13:44:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-get-1st-2nd-and-3rd-place-results-based-on-value-of-a/m-p/177257#M186749</guid>
      <dc:creator>dave_vgc</dc:creator>
      <dc:date>2014-10-31T13:44:59Z</dc:date>
    </item>
  </channel>
</rss>

