<?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 get the maximum count by host and time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520298#M146508</link>
    <description>&lt;P&gt;You could try something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index= xyz 
| bin span=1s _time
| stats count BY host_name 
| eventstats max(count) as max BY host_name
| where count=max
| stats values(count) as count, latest(_time) as _time by host_name
| fields host_name, count, _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Sep 2020 10:17:01 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-09-18T10:17:01Z</dc:date>
    <item>
      <title>How to get the maximum count by host and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520294#M146507</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to query to pick the maximum TPS count of each host(three hosts) and the time when the maximum count was reported. There maybe many instance where the count will be same for more than one time, in that case I would chose the count for the latest time. The below query picks the maximum count per host but I am unable to write the time when it was maximum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;index= xyz 
| timechart span=1s cont=false count BY host_name 
| untable _time host_name count
| stats max(count) as count BY host_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need help to know how to include the _time with my output(as I said count might be same for different time in that case I need the latest time written to the output along with host and maximum count)&lt;BR /&gt;&lt;STRONG&gt;OUTPUT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10882i9D75FECE580D9ACA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 10:02:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520294#M146507</guid>
      <dc:creator>spkriyaz</dc:creator>
      <dc:date>2020-09-18T10:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the maximum count by host and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520298#M146508</link>
      <description>&lt;P&gt;You could try something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index= xyz 
| bin span=1s _time
| stats count BY host_name 
| eventstats max(count) as max BY host_name
| where count=max
| stats values(count) as count, latest(_time) as _time by host_name
| fields host_name, count, _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 10:17:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520298#M146508</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-18T10:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the maximum count by host and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520299#M146509</link>
      <description>&lt;P&gt;It won't work as the query is not picking the maximum count of each second(Transaction per second for each host), it does the overall count and the _time is not considered in the initial stats so the _time is not considered anywhere down the line&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 10:29:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520299#M146509</guid>
      <dc:creator>spkriyaz</dc:creator>
      <dc:date>2020-09-18T10:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the maximum count by host and time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520300#M146510</link>
      <description>&lt;LI-CODE lang="markup"&gt;index= xyz 
| bin span=1s _time
| stats count BY host_name, _time
| eventstats max(count) as max BY host_name
| where count=max
| stats values(count) as count, latest(_time) as _time by host_name
| fields host_name, count, _time&lt;/LI-CODE&gt;&lt;P&gt;Good point - just add _time to the first stats (I forgot to add it after changing from timechart to stats)&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 10:32:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-maximum-count-by-host-and-time/m-p/520300#M146510</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-18T10:32:48Z</dc:date>
    </item>
  </channel>
</rss>

