<?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 limit my search to return only the top 10 results based on the following search queries ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74120#M18626</link>
    <description>&lt;P&gt;You may want to use top for this.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.2/SearchReference/Top"&gt;http://docs.splunk.com/Documentation/Splunk/4.3.2/SearchReference/Top&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access" |eval bandwidth=round(bytes_sent/1024,2)| stats sum(bandwidth) as total_bandwidth | top limit=10 total_bandwidth by client_ip

sourcetype="access" | eval bandwidth=round(bytes_sent/1024,2)|stats sum(bandwidth) as total_bandwidth | top limit=10 total_bandwidth by URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jun 2012 12:02:05 GMT</pubDate>
    <dc:creator>Lamar</dc:creator>
    <dc:date>2012-06-13T12:02:05Z</dc:date>
    <item>
      <title>How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74118#M18624</link>
      <description>&lt;P&gt;I am using these search queries and I want to restrict the search to return only the top ten results.&lt;/P&gt;

&lt;P&gt;How to do it ?&lt;/P&gt;

&lt;P&gt;The search queries I am using are :&lt;/P&gt;

&lt;P&gt;sourcetype="access" |eval bandwidth=round(bytes_sent/1024,2)| stats sum(bandwidth) BY client_ip &lt;/P&gt;

&lt;P&gt;sourcetype="access" | eval bandwidth=round(bytes_sent/1024,2)|stats sum(bandwidth) BY URL&lt;/P&gt;

&lt;P&gt;Thanks...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:56:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74118#M18624</guid>
      <dc:creator>ranjyotiprakash</dc:creator>
      <dc:date>2020-09-28T11:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74119#M18625</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_query | sort - sum(bandwidth) | head 10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you may want to name your field "bandwidth" as follow:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access" | stats sum(bytes_sent) as bandwidth BY client_ip | eval bandwidth=round(bandwidth/1024,2)  | sort - bandwidth | head 10

sourcetype="access" | stats sum(bytes_sent) as bandwidth BY URL | sort - bandwidth | eval bandwidth=round(bandwidth/1024,2) | head 10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lp&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 11:53:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74119#M18625</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2012-06-13T11:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74120#M18626</link>
      <description>&lt;P&gt;You may want to use top for this.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.2/SearchReference/Top"&gt;http://docs.splunk.com/Documentation/Splunk/4.3.2/SearchReference/Top&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access" |eval bandwidth=round(bytes_sent/1024,2)| stats sum(bandwidth) as total_bandwidth | top limit=10 total_bandwidth by client_ip

sourcetype="access" | eval bandwidth=round(bytes_sent/1024,2)|stats sum(bandwidth) as total_bandwidth | top limit=10 total_bandwidth by URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74120#M18626</guid>
      <dc:creator>Lamar</dc:creator>
      <dc:date>2012-06-13T12:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74121#M18627</link>
      <description>&lt;P&gt;This is actually incorrect. The top command will deliver the most common values, not the greatest ones.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74121#M18627</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-13T12:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74122#M18628</link>
      <description>&lt;P&gt;The head command will give you the first 10 results whereas the top command will give you the most common values of a particular field.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74122#M18628</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2012-06-13T12:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74123#M18629</link>
      <description>&lt;P&gt;But that's probably the most reasonable result for the question.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74123#M18629</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-13T12:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74124#M18630</link>
      <description>&lt;P&gt;If you just want the greatest values and not the top 10  just sort it in descending order.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:39:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74124#M18630</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2012-06-13T12:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74125#M18631</link>
      <description>&lt;P&gt;The question kind-of indicates the 10 greatest values.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74125#M18631</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-13T12:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74126#M18632</link>
      <description>&lt;P&gt;I've slightly changed the search to do the "round" after the aggregation. This is better because it reduces the rounding error.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:44:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74126#M18632</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-06-13T12:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74127#M18633</link>
      <description>&lt;P&gt;Thanks a lot for your replies.. "head" works ...&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 05:07:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74127#M18633</guid>
      <dc:creator>ranjyotiprakash</dc:creator>
      <dc:date>2012-06-14T05:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74128#M18634</link>
      <description>&lt;P&gt;Why they have used sort - bandwidth there ..can u please explain me&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 05:29:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74128#M18634</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-12T05:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74129#M18635</link>
      <description>&lt;P&gt;from the docs about &lt;CODE&gt;sort&lt;/CODE&gt; &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Sort"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Sort&lt;/A&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Description: List of fields to sort by and their order, descending ( - ) or ascending ( + ).
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2015 05:33:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74129#M18635</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-05-12T05:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74130#M18636</link>
      <description>&lt;P&gt;yah.!!&lt;BR /&gt;
Got it. Thank you. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 06:17:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/74130#M18636</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-12T06:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit my search to return only the top 10 results based on the following search queries ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/673539#M230637</link>
      <description>&lt;P&gt;The usage of sort is fine if the number of items is not too large. To sort a large number of items is time consuming, and there is a limit in Splunk. Because of the limit, the attempt to sort the items and then to select the first 10 items might end in a wrong result.&lt;/P&gt;&lt;P&gt;In order to avoid this, I filter all items above/below a limit that is specific to the problem. For instance, 50 000 records are processed, more than 49 000 records are processed within 2 seconds, but there are a few records for which the processing takes more time. So I set the limit to 2 seconds.&lt;BR /&gt;However, if there are just a few records, e.g., 10, then it might be the case that the list of Top 10 results is empty because all of them are below the limit of 2 seconds.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 14:54:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-limit-my-search-to-return-only-the-top-10-results-based/m-p/673539#M230637</guid>
      <dc:creator>Konrad_Schlude</dc:creator>
      <dc:date>2024-01-08T14:54:12Z</dc:date>
    </item>
  </channel>
</rss>

