<?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 do you find the earliest event in an index by sourcetype and source? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341696#M170187</link>
    <description>&lt;P&gt;Try this.. Set it to all-time. It uses the tsidx files for searching so it will be quick&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch index = A sourcetype=A AND source="/tmp/A.app.log"
| stats earliest(_time) AS Earliest_Time
|  eval Earliest_Time=strftime(Earliest_Time,"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Apr 2018 01:55:30 GMT</pubDate>
    <dc:creator>skoelpin</dc:creator>
    <dc:date>2018-04-19T01:55:30Z</dc:date>
    <item>
      <title>How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341695#M170186</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have index = A  sourcetype = A  and source = /tmp/A.app.log&lt;/P&gt;

&lt;P&gt;I want to find the earliest event  (date and time) for the above.&lt;/P&gt;

&lt;P&gt;Please advise how to write this query.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 01:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341695#M170186</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-04-19T01:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341696#M170187</link>
      <description>&lt;P&gt;Try this.. Set it to all-time. It uses the tsidx files for searching so it will be quick&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch index = A sourcetype=A AND source="/tmp/A.app.log"
| stats earliest(_time) AS Earliest_Time
|  eval Earliest_Time=strftime(Earliest_Time,"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Apr 2018 01:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341696#M170187</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-04-19T01:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341697#M170188</link>
      <description>&lt;P&gt;Try the tstats command with appropriate time range (try avoid using 'All times', choose a time range large enough that you know there would be some events for that index/sourcetype/source combination).&lt;/P&gt;

&lt;P&gt;For specific  index/sourcetype/source combination&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats max(_time) as lastReportedOn by index=A sourcetype=A source=/tmp/A.app.log by index sourcetype source | convert ctime(lastReportedOn)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For all sourcetype/source combinations in an index&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats max(_time) as lastReportedOn by index=A  by index sourcetype source | convert ctime(lastReportedOn)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Apr 2018 04:51:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341697#M170188</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-19T04:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341698#M170189</link>
      <description>&lt;P&gt;Thank you for the reply, for some reason |tstats is not working in my environment, I have used it before in other environments / deployments and it worked.   Metasearch does work.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341698#M170189</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-04-19T14:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341699#M170190</link>
      <description>&lt;P&gt;Thank you for the reply, your metasearch is giving me results.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:03:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341699#M170190</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-04-19T14:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341700#M170191</link>
      <description>&lt;P&gt;slight typo on the query - this tstats search is faster than the metadata one if correctly typed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   | tstats max(_time) as lastReportedOn where index=A sourcetype=A source=/tmp/A.app.log by index sourcetype source | convert ctime(lastReportedOn)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 18:17:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/341700#M170191</guid>
      <dc:creator>aokur_splunk</dc:creator>
      <dc:date>2020-01-21T18:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do you find the earliest event in an index by sourcetype and source?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/620870#M215818</link>
      <description>&lt;LI-CODE lang="markup"&gt;| stats earliest(_time) AS Earliest_Time
|  eval Earliest_Time=strftime(Earliest_Time,"%Y-%m-%d %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;can be replaced by a simple&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats earliest(_time) AS _time&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Splunk formats _time by default which allows you to avoid having to reformat the display of another field dedicated to time display.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 10:50:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-find-the-earliest-event-in-an-index-by-sourcetype-and/m-p/620870#M215818</guid>
      <dc:creator>cyvi01</dc:creator>
      <dc:date>2022-11-15T10:50:00Z</dc:date>
    </item>
  </channel>
</rss>

