<?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 return a group by value with the highest number of items? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303443#M91298</link>
    <description>&lt;P&gt;How do I modify the following query to return the name of the FRUIT with the highest count:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" URI="myuri" | stats count by FRUIT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Jonathan&lt;/P&gt;</description>
    <pubDate>Wed, 21 Feb 2018 18:47:57 GMT</pubDate>
    <dc:creator>jbrenner</dc:creator>
    <dc:date>2018-02-21T18:47:57Z</dc:date>
    <item>
      <title>How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303443#M91298</link>
      <description>&lt;P&gt;How do I modify the following query to return the name of the FRUIT with the highest count:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" URI="myuri" | stats count by FRUIT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Jonathan&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 18:47:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303443#M91298</guid>
      <dc:creator>jbrenner</dc:creator>
      <dc:date>2018-02-21T18:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303444#M91299</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" URI="myuri" | stats count by FRUIT|stats max(count) as max
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2018 18:55:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303444#M91299</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-21T18:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303445#M91300</link>
      <description>&lt;P&gt;That gives me the count, but I want to return the name of the fruit.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Jonathan&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 19:00:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303445#M91300</guid>
      <dc:creator>jbrenner</dc:creator>
      <dc:date>2018-02-21T19:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303446#M91301</link>
      <description>&lt;P&gt;ok then try this it will give max count with name of fruit:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" URI="myuri" | stats count by FRUIT|stats max(count) as max by FRUIT|head 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2018 19:26:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303446#M91301</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-21T19:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303447#M91302</link>
      <description>&lt;P&gt;You can do like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex" URI="myuri" | top 1 FRUIT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you name of top 1 FRUIT based on event count. You can adjust the number in top command to return more&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 19:33:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303447#M91302</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-21T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303448#M91303</link>
      <description>&lt;P&gt;Hi somesoni2,&lt;/P&gt;

&lt;P&gt;That is perfect, thanks!&lt;BR /&gt;&lt;BR /&gt;
Now how could I modify your query to return the fruit name concatenated to the count in a single string like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; apple:2013
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Jonathan&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 19:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303448#M91303</guid>
      <dc:creator>jbrenner</dc:creator>
      <dc:date>2018-02-21T19:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to return a group by value with the highest number of items?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303449#M91304</link>
      <description>&lt;P&gt;A simple eval statement will do that&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;above search | eval FRUIT=FRUIT.":".count 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2018 20:13:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-a-group-by-value-with-the-highest-number-of-items/m-p/303449#M91304</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-21T20:13:52Z</dc:date>
    </item>
  </channel>
</rss>

