<?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 Difference between lastTime and recentTime in metadata output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62193#M15364</link>
    <description>&lt;P&gt;Can someone explain the distinction between the &lt;CODE&gt;lastTime&lt;/CODE&gt; and &lt;CODE&gt;recentTime&lt;/CODE&gt; fields in the output of the &lt;CODE&gt;| metadata&lt;/CODE&gt; command?&lt;/P&gt;</description>
    <pubDate>Fri, 01 Oct 2010 22:00:19 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2010-10-01T22:00:19Z</dc:date>
    <item>
      <title>Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62193#M15364</link>
      <description>&lt;P&gt;Can someone explain the distinction between the &lt;CODE&gt;lastTime&lt;/CODE&gt; and &lt;CODE&gt;recentTime&lt;/CODE&gt; fields in the output of the &lt;CODE&gt;| metadata&lt;/CODE&gt; command?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2010 22:00:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62193#M15364</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-10-01T22:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62194#M15365</link>
      <description>&lt;P&gt;&lt;CODE&gt;firstTime&lt;/CODE&gt; and &lt;CODE&gt;lastTime&lt;/CODE&gt; show you the bounds of your timestamps for the entry in question.  Think of this like &lt;CODE&gt;| stats min(_time) as firstTime, max(_time) as lastTime&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;recentTime&lt;/CODE&gt; is the last timestamp that splunk received for the given entry in question.  (This would be something like &lt;CODE&gt;| sort -_indextime | head 1 | rename _time as recentTime&lt;/CODE&gt;.)&lt;/P&gt;

&lt;P&gt;Keep in mind that the &lt;CODE&gt;metadata&lt;/CODE&gt; command is really just pulling in saved statistics about your host/source/sourcetype that are stored within an individual index.  (You can see them in the &lt;CODE&gt;*.data&lt;/CODE&gt; files within the index folder and under individual bucket folders.)  Keep in mind that the search examples above are really only meant to give you a comparable idea of what's going on, but they are probably over simplified.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;So, unless you have events coming in out of order, then &lt;CODE&gt;lastTime&lt;/CODE&gt; and &lt;CODE&gt;recentTime&lt;/CODE&gt; will probably contain the same value.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2010 22:04:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62194#M15365</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-10-01T22:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62195#M15366</link>
      <description>&lt;P&gt;The question has been answered before: &lt;A href="http://answers.splunk.com/questions/5626/what-is-the-difference-between-lasttime-and-recenttime-in-a-metadata-search/5630#5630" rel="nofollow"&gt;http://answers.splunk.com/questions/5626/what-is-the-difference-between-lasttime-and-recenttime-in-a-metadata-search/5630#5630&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It seems like recentTime is (possibly extracted) timestamp of the last event that has gotten into the index and lastTime is the latest timestamp found in the index - &lt;CODE&gt;max(_time)&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;So none of the values would represent &lt;CODE&gt;max(_indextime)&lt;/CODE&gt; as I understood.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Oct 2010 22:18:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62195#M15366</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2010-10-01T22:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62196#M15367</link>
      <description>&lt;P&gt;After looking closer at the values, I think you are correct about the &lt;CODE&gt;max(_indextime)&lt;/CODE&gt; thing.  I've updated my answer accordingly.  Thanks for pointing this out.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2010 02:43:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62196#M15367</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-10-02T02:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62197#M15368</link>
      <description>&lt;P&gt;Let me know if this is better suited as a separate question:&lt;/P&gt;

&lt;P&gt;Is it a correct interpretation to say that if using metadata like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index=* OR index=_* ) type=hosts
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then the recentTime is the timestamp for the last event from each of the hosts while the lastTime is the last thing we "heard" from that host's forwarder?&lt;/P&gt;

&lt;P&gt;Said another way, if a forwarder does not see anything new written to a log file that it monitors, the recentTime will start to get older.  If that same forwarder is forwarding it's _internal|_audit data then the lastTime may be more recent due to normal forwarder/indexer communication.&lt;/P&gt;

&lt;P&gt;Is that correct? I'm asking because I realize this could be an effective way to monitor for forwarders that stopped communicating with indexers.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:49:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62197#M15368</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2020-09-28T15:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62198#M15369</link>
      <description>&lt;P&gt;A lot of Splunk articles say that &lt;CODE&gt;recentTime&lt;/CODE&gt; and &lt;CODE&gt;localTime&lt;/CODE&gt; will be the same, but that's not true if your devices don't all store data in UTC time.&lt;/P&gt;

&lt;P&gt;In our experience, &lt;CODE&gt;recentTime&lt;/CODE&gt; is relative to the local time of whoever is conducting the search, while &lt;CODE&gt;lastTime&lt;/CODE&gt; is the latest timestamp reported by the device and stored inside an index.&lt;/P&gt;

&lt;P&gt;If you have devices in different timezones (in other words, you don't use GMT/UTC), you need to be careful about the different commands.  Example:  If you want an alert on devices that haven't reported to an index in the last 1800 seconds, we use &lt;CODE&gt;recentTime&lt;/CODE&gt; so that everything is relative to the local time:&lt;BR /&gt;
&lt;CODE&gt;| metadata index=indexname type=hosts | eval age=now()-recentTime | search age&amp;gt;1800&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If you use &lt;CODE&gt;lastTime&lt;/CODE&gt;, your ages will be all over the place because devices are reporting from different timezones.  A negative age means the device is in a timezone ahead of yours, so it thinks the device is in the future.&lt;/P&gt;

&lt;P&gt;If you want to see for yourself, try &lt;CODE&gt;| metadata index=indexname type=hosts | eval age=now()-recentTime&lt;/CODE&gt; and then try &lt;CODE&gt;| metadata index=indexname type=hosts | eval age=now()-lastTime&lt;/CODE&gt; and see the difference in ages.&lt;/P&gt;

&lt;P&gt;Summary&lt;BR /&gt;
&lt;CODE&gt;recentTime&lt;/CODE&gt;: Timezone of the search head/indexer&lt;BR /&gt;
&lt;CODE&gt;lastTime&lt;/CODE&gt;: Last timestamp seen in the data (potentially a different timezone)&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 14:39:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62198#M15369</guid>
      <dc:creator>ahjmcaleer</dc:creator>
      <dc:date>2015-09-09T14:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between lastTime and recentTime in metadata output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62199#M15370</link>
      <description>&lt;P&gt;Never thought about it that way.&lt;/P&gt;

&lt;P&gt;The way I've been thinking about it going forward was that one represented the time of the last seen event (_time) while the other was the time the last event was indexed (_indextime). The docs page has since been updated nicely: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Metadata&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The &lt;STRONG&gt;lastTime&lt;/STRONG&gt; field is the &lt;STRONG&gt;timestamp&lt;/STRONG&gt; for the last time that the indexer saw an event from this host.&lt;BR /&gt;
The &lt;STRONG&gt;recentTime&lt;/STRONG&gt; field is the &lt;STRONG&gt;indextime&lt;/STRONG&gt; for the most recent time that the index saw an event from this &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:14:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-lastTime-and-recentTime-in-metadata-output/m-p/62199#M15370</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2020-09-29T07:14:49Z</dc:date>
    </item>
  </channel>
</rss>

