<?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: Grab max value and associated value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283424#M85652</link>
    <description>&lt;P&gt;The first three lines were cribbed from somesoni2's response.  I usually use the synonym "bin" instead of "bucket".&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2017 17:37:51 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-02-09T17:37:51Z</dc:date>
    <item>
      <title>Grab max value and associated value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283419#M85647</link>
      <description>&lt;P&gt;I have a stats table of max hits by API for a given time period.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ml_summary" report=api_stats earliest=-1w@w latest=now()  | stats count as hit by date_minute, date_hour,date_mday,date_month,date_year, api| stats max(hit) as maxhit by api 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns multiple lines, showing each api name and the max hits for that api.&lt;/P&gt;

&lt;P&gt;How do I now reduce the results to a single line with the max hits from that set AND its associated api label?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 15:47:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283419#M85647</guid>
      <dc:creator>feickertmd</dc:creator>
      <dc:date>2017-02-09T15:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Grab max value and associated value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283420#M85648</link>
      <description>&lt;P&gt;Give this a try (slighly modified the initial part)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ml_summary" report=api_stats earliest=-1w@w latest=now()  | bucket span=1m _time | stats count as hit by _time api| stats max(hit) as maxhit by api | sort 1 maxhit
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to keep the original, just add the &lt;CODE&gt;| sort 1 maxhit&lt;/CODE&gt; at the end of your version.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 16:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283420#M85648</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-09T16:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Grab max value and associated value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283421#M85649</link>
      <description>&lt;P&gt;Duh. I knew I was looking too deep and complex. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 16:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283421#M85649</guid>
      <dc:creator>feickertmd</dc:creator>
      <dc:date>2017-02-09T16:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Grab max value and associated value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283422#M85650</link>
      <description>&lt;P&gt;Somesoni2's solution is good for what you asked.  &lt;/P&gt;

&lt;P&gt;There is the possibility that you might have two or more of the same highest-hit minute, and you might also like to know WHEN you got the most hits on that , so you might consider something like this -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="ml_summary" report=api_stats earliest=-1w@w latest=now()  
| bucket span=1m _time 
| stats count as hit by _time api
| eventstats max(hit) as overallmaxhit 
| where hit=overallmaxhit
| table api hit _time 
| eval _time=strftime(_time,"%Y-%m-%d %H:%M)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Feb 2017 16:56:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283422#M85650</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-09T16:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Grab max value and associated value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283423#M85651</link>
      <description>&lt;P&gt;Ah, thank you. I forgot about bucket!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 17:27:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283423#M85651</guid>
      <dc:creator>feickertmd</dc:creator>
      <dc:date>2017-02-09T17:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Grab max value and associated value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283424#M85652</link>
      <description>&lt;P&gt;The first three lines were cribbed from somesoni2's response.  I usually use the synonym "bin" instead of "bucket".&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 17:37:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grab-max-value-and-associated-value/m-p/283424#M85652</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-09T17:37:51Z</dc:date>
    </item>
  </channel>
</rss>

