<?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: Display Last Event Time in Stats function in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41913#M9720</link>
    <description>&lt;P&gt;I like the answer. &lt;/P&gt;

&lt;P&gt;Shangshin, just note that latest is a function of stats only in Splunk versions past 4.3.  If you have &amp;lt;4.3, try "| stats max(time_in_sec), min(time_in_sec) avg(time_in_sec), first(_time) as latest_time by url | convert ctime(latest_time)"&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:18:48 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2020-09-28T12:18:48Z</dc:date>
    <item>
      <title>Display Last Event Time in Stats function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41911#M9718</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
    I would like to display the last event time when using stats function. the following search string works but the time is not human readable. I tried to use the convert function &lt;STRONG&gt;strftime(last(_time), "%m/%d %H:%M:%S")&lt;/STRONG&gt; but it's not working.&lt;/P&gt;

&lt;P&gt;I would sppreciate if anyone could shed some light on this. Thanks!&lt;/P&gt;

&lt;P&gt;stats max(time_in_sec), min(time_in_sec), avg(time_in_sec), last(_time) by url&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:18:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41911#M9718</guid>
      <dc:creator>shangshin</dc:creator>
      <dc:date>2020-09-28T12:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Display Last Event Time in Stats function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41912#M9719</link>
      <description>&lt;P&gt;Since you want to display the time stamp of the most recent event in the results, I would recommend using latest() instead of last(). Consider the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonStatsFunctions"&gt;following definition of latest()&lt;/A&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;latest(X)    This function returns the chronologically latest seen occurrence of a value of a field X.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Anyway, I here is the suggested search string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats max(time_in_sec), min(time_in_sec), avg(time_in_sec), latest(_time) AS latest_time by url | convert ctime(latest_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2012 14:59:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41912#M9719</guid>
      <dc:creator>hexx</dc:creator>
      <dc:date>2012-08-22T14:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Display Last Event Time in Stats function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41913#M9720</link>
      <description>&lt;P&gt;I like the answer. &lt;/P&gt;

&lt;P&gt;Shangshin, just note that latest is a function of stats only in Splunk versions past 4.3.  If you have &amp;lt;4.3, try "| stats max(time_in_sec), min(time_in_sec) avg(time_in_sec), first(_time) as latest_time by url | convert ctime(latest_time)"&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41913#M9720</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2020-09-28T12:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Display Last Event Time in Stats function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41914#M9721</link>
      <description>&lt;P&gt;Thanks for the info. My splunk version is 4.3.1 but the function, latest, seems not working.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2012 20:03:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-Last-Event-Time-in-Stats-function/m-p/41914#M9721</guid>
      <dc:creator>shangshin</dc:creator>
      <dc:date>2012-08-22T20:03:52Z</dc:date>
    </item>
  </channel>
</rss>

