<?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: Help using earliest, latest and finding the first occurrence of string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424335#M121699</link>
    <description>&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Event1: I need to go through the logs of this event and find the EARLIEST occurrence of the word “example1” in one of the paragraphs it contains. &lt;/P&gt;

&lt;P&gt;index=yourindex "example1" | stats earliest(_time) as earliest | convert ctime(earliest)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event2: same as Event1 but I need to go through event2 and find EARLIEST occurrence of the word “example2”.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "example2" | stats earliest(_time) as earliest | convert ctime(earliest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event3: find the EARLIEST log of event3.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event3" | stats earliest(_time) as earliest | convert ctime(earliest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event4: find the LATEST log of event4&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event4" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event5: find the LATEST log of event [5]. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event5" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event6: I need to go through the logs of this event and find the LATEST occurrence of the word “example6” in one of the paragraphs it contains. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event6" "example6" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event7: same as Event6 but I need to go through event7 and find LATEST occurrence of the word “example7”.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event6" "example7" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 17 Jun 2019 13:11:52 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2019-06-17T13:11:52Z</dc:date>
    <item>
      <title>Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424331#M121695</link>
      <description>&lt;P&gt;I have 7 different fields that I need to get information from in different ways. They're all under the same index, source and sourcetype.  Here are the 7 fields and the 7 different things that I need to achieve:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Field1: I need to go through the logs of this Field and find the EARLIEST time one of the values inside this field contains the word "Example1"&lt;/LI&gt;
&lt;LI&gt;Field2: same as in Field1 but I need to go through Field2 and find the EARLIEST time the word “example2” is in one of its values.&lt;/LI&gt;
&lt;LI&gt;Field3: find the EARLIEST value of Field3.&lt;/LI&gt;
&lt;LI&gt;Field4: find the LATEST value of Field4&lt;/LI&gt;
&lt;LI&gt;Field5: find the LATEST value of Field4. &lt;/LI&gt;
&lt;LI&gt;Field6:  I need to go through the values of this Field and find the LATEST time one of the values inside this field contains the word "Example6"&lt;/LI&gt;
&lt;LI&gt;Field7: same as Field6 but I need to go through Field7 and find LATEST occurrence of the word “example7”.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I want to store each of these times acquired in each field as different values. My goal is to have a table displaying the times I found for each occurrence. &lt;BR /&gt;
Further, some of the fields may not contain the world I'm looking for so I want it to stay blank. I do not want to restrict the number of events. &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7201iEF64D4AA08EA59EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 16:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424331#M121695</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-15T16:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424332#M121696</link>
      <description>&lt;P&gt;Please provide some sample data.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 17:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424332#M121696</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-15T17:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424333#M121697</link>
      <description>&lt;P&gt;Your explanation is very confusing, and I think you are using the wrong terminology.&lt;/P&gt;

&lt;P&gt;Sample data would be extremely helpful.&lt;/P&gt;

&lt;P&gt;Questions:&lt;BR /&gt;
- What is event1 (event2, event3, ... event7) ?&lt;BR /&gt;&lt;BR /&gt;
- Is that a particular event that happens in a log somewhere?&lt;BR /&gt;&lt;BR /&gt;
- How can you uniquely identify event1?&lt;BR /&gt;&lt;BR /&gt;
- Is there an event code you can reference?&lt;BR /&gt;
- What is your overall goal for all of these searches?&lt;BR /&gt;
- Are you creating alerts?&lt;BR /&gt;
- Are you creating a report?&lt;BR /&gt;
- Do you want to display results in a dashboard?&lt;/P&gt;

&lt;P&gt;Providing context as well as sample data well go a long way in allowing others to consider options for your request.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 18:18:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424333#M121697</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-15T18:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424334#M121698</link>
      <description>&lt;P&gt;I agree with the other comments.  Use the terms correctly, provide sample data, and a mockup of the desired final output.  It looks like perhaps when you wrote &lt;CODE&gt;event&lt;/CODE&gt;, you meant &lt;CODE&gt;sourcetype&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 22:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424334#M121698</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-15T22:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424335#M121699</link>
      <description>&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Event1: I need to go through the logs of this event and find the EARLIEST occurrence of the word “example1” in one of the paragraphs it contains. &lt;/P&gt;

&lt;P&gt;index=yourindex "example1" | stats earliest(_time) as earliest | convert ctime(earliest)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event2: same as Event1 but I need to go through event2 and find EARLIEST occurrence of the word “example2”.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "example2" | stats earliest(_time) as earliest | convert ctime(earliest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event3: find the EARLIEST log of event3.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event3" | stats earliest(_time) as earliest | convert ctime(earliest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event4: find the LATEST log of event4&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event4" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event5: find the LATEST log of event [5]. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event5" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event6: I need to go through the logs of this event and find the LATEST occurrence of the word “example6” in one of the paragraphs it contains. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event6" "example6" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Event7: same as Event6 but I need to go through event7 and find LATEST occurrence of the word “example7”.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=yourindex "event6" "example7" | stats latest(_time) as latest| convert ctime(latest) 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 17 Jun 2019 13:11:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424335#M121699</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2019-06-17T13:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424336#M121700</link>
      <description>&lt;P&gt;You can try this:&lt;BR /&gt;
&lt;PRE&gt;index=myindex ("example1" OR "example2" OR "event3" OR "event4" OR "event5" OR "example6" OR "example7")&lt;BR /&gt;
| eval type = case(match(_raw, "example1"), "Event1", match(_raw, "example2"), "Event2", match(_raw, "event3"), "Event3", match(_raw, "event4"), "Event4", match(_raw, "event5"), "Event5", match(_raw, "example6"), "Event6", match(_raw, "example7"), "Event7")&lt;BR /&gt;
| stats earliest(eval(strftime(case(type=="Event1", _time), "%F %T"))) as EarliestEvent1, earliest(eval(strftime(case(type=="Event2", _time), "%F %T"))) as EarliestEvent2, earliest(eval(strftime(case(type=="Event3", _time), "%F %T"))) as EarliestEvent3, latest(eval(strftime(case(type=="Event4", _time), "%F %T"))) as LatestEvent4, latest(eval(strftime(case(type=="Event5", _time), "%F %T"))) as LatestEvent5, latest(eval(strftime(case(type=="Event6", _time), "%F %T"))) as LatestEvent6, latest(eval(strftime(case(type=="Event7", _time), "%F %T"))) as LatestEvent7&lt;BR /&gt;
&lt;/PRE&gt;&lt;BR /&gt;
Here is what it will look like with some dummy data:&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/273920-screenshot-from-2019-06-17-13-09-39.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Without more detail of what exactly you're looking for and a sample of data / mock-up of what you want to see, it's difficult to provide what you're looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:57:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424336#M121700</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2020-09-30T00:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424337#M121701</link>
      <description>&lt;P&gt;I've updated the question. Let me know if you have any questions. Sorry for the confusion.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 18:29:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424337#M121701</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-17T18:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424338#M121702</link>
      <description>&lt;P&gt;I've updated the question.  Sorry for the confusion. I cannot provide sample data as it contains sensitive information. Again, Im so sorry for the confusion. I'm a new user and confused myself with the terminology&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 18:30:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424338#M121702</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-17T18:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424339#M121703</link>
      <description>&lt;P&gt;You can provide sample data, with all sensitive information masked out.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 20:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424339#M121703</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-17T20:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424340#M121704</link>
      <description>&lt;P&gt;I've added a picture and I highlighted the word that I'm trying to get the time of (In that case, the earliest)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 13:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424340#M121704</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-18T13:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424341#M121705</link>
      <description>&lt;P&gt;I've added a picture and I highlighted the word that I'm trying to get the time of (In that case, the earliest)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 13:11:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424341#M121705</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-18T13:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424342#M121706</link>
      <description>&lt;P&gt;Utilizing earliest(_time) works for me, but when I use it twice the time doesn't update. For example if the first occurrence of the word "example1" is at 1:22 and the first occurrence of the word "example2" is at 1:07 then both store 1:07 as the time stamp. Is there any way to fix this? Can I clear earliest(_time)?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424342#M121706</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2020-09-30T01:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424343#M121707</link>
      <description>&lt;P&gt;This doesnt work. Earliestevent1,2,3 are displaying the same time. Utilizing earliest(_time) works for me, but when I use it twice the time doesn't update. For example if the first occurrence of the word "example1" is at 1:22 and the first occurrence of the word "example2" is at 1:07 then both store 1:07 as the time stamp. Is there any way to fix this? Can I clear earliest(_time)? I want to get the first time that "event1" was written and the first time "event2" was written and save them in two different values. Im trying to create a timeline so I need the specific times for each.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424343#M121707</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2020-09-30T01:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424344#M121708</link>
      <description>&lt;P&gt;You can use stats min(_time} as earliest | concert ctime(earliest)&lt;/P&gt;

&lt;P&gt;Or several as long as you use "as" clause to rename it.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 18:13:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424344#M121708</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2019-06-27T18:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424345#M121709</link>
      <description>&lt;P&gt;Could you refer to this post? &lt;A href="https://answers.splunk.com/answers/755758/using-join-earliest-table-and-latest.html?minQuestionBodyLength=80"&gt;https://answers.splunk.com/answers/755758/using-join-earliest-table-and-latest.html?minQuestionBodyLength=80&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It explains my issue a little bit more. I tried using min and it still doesnt work. Thank you so much &lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 19:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424345#M121709</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-27T19:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help using earliest, latest and finding the first occurrence of string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424346#M121710</link>
      <description>&lt;P&gt;I was able to figure out a lot of it. I'm running into a problem when using earliest(_time) several times: &lt;A href="https://answers.splunk.com/answers/755758/using-join-earliest-table-and-latest.html?minQuestionBodyLength=80"&gt;https://answers.splunk.com/answers/755758/using-join-earliest-table-and-latest.html?minQuestionBodyLength=80&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 19:14:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-earliest-latest-and-finding-the-first-occurrence-of/m-p/424346#M121710</guid>
      <dc:creator>xploresplunk</dc:creator>
      <dc:date>2019-06-27T19:14:10Z</dc:date>
    </item>
  </channel>
</rss>

