<?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: Get the top n results when searched by count and span in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669201#M229527</link>
    <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command has a &lt;FONT face="courier new,courier"&gt;limit&lt;/FONT&gt; option that will give you the top n results.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=5min limit=5 count(action) by applicationname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 14:53:21 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-11-20T14:53:21Z</dc:date>
    <item>
      <title>Get the top n results when searched by count and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669197#M229525</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I am trying to get the top n users who made calls to some APIs over a span of 5 minutes.&lt;/P&gt;
&lt;P&gt;For example:&lt;BR /&gt;By the below query, I can see the chart which made calls for a period of time over a span of 5 minutes.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;Query&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;timechart span=5min count(action) by applicationname&lt;/LI-CODE&gt;
&lt;P&gt;Now, I need to select the top n users (applicationname) which had high number of calls only for a span of 5 minutes.&lt;/P&gt;
&lt;P&gt;In the below image, need the the users with sudden spikes.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28177i11A0FA7BAD77874C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 15:05:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669197#M229525</guid>
      <dc:creator>SaiDarur</dc:creator>
      <dc:date>2023-11-20T15:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get the top n results when searched by count and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669201#M229527</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;timechart&lt;/FONT&gt; command has a &lt;FONT face="courier new,courier"&gt;limit&lt;/FONT&gt; option that will give you the top n results.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=5min limit=5 count(action) by applicationname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 14:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669201#M229527</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-11-20T14:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get the top n results when searched by count and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669206#M229530</link>
      <description>&lt;P&gt;It's not that easy &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. Often overlooked thing - timechart with span=something means just chopping time into span-sized slices. It does _not_ mean doing a sliding window aggregation. I suppose you can't do that other way than using streamstats.&lt;/P&gt;&lt;P&gt;2. limit=X with timechart gives you only X top results _overall_, not per each bin.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 15:14:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669206#M229530</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-11-20T15:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get the top n results when searched by count and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669208#M229531</link>
      <description>&lt;P&gt;Thank you both. Is there any other way where I can achieve this?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 15:28:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669208#M229531</guid>
      <dc:creator>SaiDarur</dc:creator>
      <dc:date>2023-11-20T15:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get the top n results when searched by count and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669213#M229534</link>
      <description>&lt;P&gt;To get the count over a sliding window you'd need to do - as I mentioned - streamstats with time_window set to your 5 minutes. Then you can do a simple top command or something like that.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 15:31:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669213#M229534</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-11-20T15:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get the top n results when searched by count and span</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669232#M229543</link>
      <description>&lt;P&gt;Thank you both. Is there any other approach to get this result? If so, please do help me on this.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 17:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-top-n-results-when-searched-by-count-and-span/m-p/669232#M229543</guid>
      <dc:creator>SaiDarur</dc:creator>
      <dc:date>2023-11-20T17:49:43Z</dc:date>
    </item>
  </channel>
</rss>

