<?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 How to get top 20 results from each category based on data size? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591599#M205942</link>
    <description>&lt;P&gt;I've below search:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| tstats summariesonly=true count, sum(All_Traffic.bytes) as total_bytes, sum(All_Traffic.packets) as total_packets from datamodel=Network_Traffic by All_Traffic.src_ip, All_Traffic.dest_ip, All_Traffic.action 
| rename "All_Traffic.*" as * 
| stats sum(total_bytes) as total_bytes, sum(total_packets) as total_packets by src_ip dest_ip action 
| sort 0 -total_bytes 
| streamstats count as count by action 
| search count&amp;lt;=20&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The purpose of using the last 3 lines with &lt;STRONG&gt;sort and streamstats &lt;/STRONG&gt;is I want the top 20 results by total_bytes from each value of the action field.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The only problem with this solution is that streamstats has a limit of &lt;STRONG&gt;10000&lt;/STRONG&gt; in&lt;STRONG&gt; limits.conf&lt;/STRONG&gt;. Do we have any better solution for this?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2022 22:32:16 GMT</pubDate>
    <dc:creator>VatsalJagani</dc:creator>
    <dc:date>2022-03-30T22:32:16Z</dc:date>
    <item>
      <title>How to get top 20 results from each category based on data size?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591599#M205942</link>
      <description>&lt;P&gt;I've below search:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| tstats summariesonly=true count, sum(All_Traffic.bytes) as total_bytes, sum(All_Traffic.packets) as total_packets from datamodel=Network_Traffic by All_Traffic.src_ip, All_Traffic.dest_ip, All_Traffic.action 
| rename "All_Traffic.*" as * 
| stats sum(total_bytes) as total_bytes, sum(total_packets) as total_packets by src_ip dest_ip action 
| sort 0 -total_bytes 
| streamstats count as count by action 
| search count&amp;lt;=20&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The purpose of using the last 3 lines with &lt;STRONG&gt;sort and streamstats &lt;/STRONG&gt;is I want the top 20 results by total_bytes from each value of the action field.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The only problem with this solution is that streamstats has a limit of &lt;STRONG&gt;10000&lt;/STRONG&gt; in&lt;STRONG&gt; limits.conf&lt;/STRONG&gt;. Do we have any better solution for this?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 22:32:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591599#M205942</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-03-30T22:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 20 results from each category based on data size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591629#M205957</link>
      <description>&lt;P&gt;"The maxresultrows setting specifies a top limit for the window argument. This sets the number of result rows that the streamstats command processor can store in memory. The max_mem_usage_mb setting limits how much memory the streamstats command uses to keep track of information."&lt;/P&gt;&lt;P&gt;It doesn't mean that it cannot process more than 10000 rows of results.&lt;/P&gt;&lt;P&gt;It means that it can use at most maxresultrows to keep track of the stats. And that's completely different.&lt;/P&gt;&lt;P&gt;For example, for a simple&lt;/P&gt;&lt;PRE&gt;streamstats count&lt;/PRE&gt;&lt;P&gt;Splunk needs to keep track only of one counter.&lt;/P&gt;&lt;P&gt;If you count by some field, it needs to keep track of count of each encountered field value and so on.&lt;/P&gt;&lt;P&gt;To be honest, I'm not even sure those get counted against the limit.&lt;/P&gt;&lt;P&gt;If you use a bigger window, Splunk has to remember previous values of results to calculate stats over the window. That's where the limit might kick in.&lt;/P&gt;&lt;P&gt;So if you have relatively few actions, you shouldn't even notice the streamstats impact memorywise.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 21:33:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591629#M205957</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-30T21:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 20 results from each category based on data size</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591667#M205969</link>
      <description>&lt;P&gt;Just has two action values. "allowed" and "blocked", and I still notice this issue.&lt;/P&gt;&lt;P&gt;I'm okay if there is another solution than streamstats to achieve this outcome.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 05:20:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-top-20-results-from-each-category-based-on-data-size/m-p/591667#M205969</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-03-31T05:20:13Z</dc:date>
    </item>
  </channel>
</rss>

