<?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 How to find earliest time a string appeared in a value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422981#M121436</link>
    <description>&lt;P&gt;I have a field named "example", I want to find the first time that the first log that contained the word "hello". &lt;BR /&gt;
How can I do this? &lt;/P&gt;

&lt;P&gt;In other words, I have a field named "example" that contains several logs with text values. I want to obtain the time of the first log that contained the word "hello".&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jun 2019 15:09:50 GMT</pubDate>
    <dc:creator>mlaurabermudez</dc:creator>
    <dc:date>2019-06-14T15:09:50Z</dc:date>
    <item>
      <title>How to find earliest time a string appeared in a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422981#M121436</link>
      <description>&lt;P&gt;I have a field named "example", I want to find the first time that the first log that contained the word "hello". &lt;BR /&gt;
How can I do this? &lt;/P&gt;

&lt;P&gt;In other words, I have a field named "example" that contains several logs with text values. I want to obtain the time of the first log that contained the word "hello".&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:09:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422981#M121436</guid>
      <dc:creator>mlaurabermudez</dc:creator>
      <dc:date>2019-06-14T15:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to find earliest time a string appeared in a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422982#M121437</link>
      <description>&lt;P&gt;Does this give you what you are looking for:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YOURINDEX sourcetype=YOURSOURCETYPE example="*hello*" 
| stats earliest(_time) as earliest_time 
| eval earliest_time=strftime(earliest_time,"%m/%d/%Y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jun 2019 16:15:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422982#M121437</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2019-06-14T16:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to find earliest time a string appeared in a value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422983#M121438</link>
      <description>&lt;P&gt;@mlaurabermudez&lt;/P&gt;

&lt;P&gt;You want to go something like - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="SomeIndex" sourcetype="SomeSourceType" example="*hello*" | stats min(_time) as earliestTime values(example) as example latest(_raw) as RawEvent  | eval earliestTime=strftime(earliestTime,"%+")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And if you are saying that you need to do this for 2 different values in 2 different events, you would want to bring in the group by, Like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="SomeIndex" sourcetype="SomeSourceType" example="hello1" OR example="*hello2*" | stats min(_time) as earliestTime latest(_raw) as RawEvent by example  | eval earliestTime=strftime(earliestTime,"%+")'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know if this answers your question! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 07:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-earliest-time-a-string-appeared-in-a-value/m-p/422983#M121438</guid>
      <dc:creator>amitm05</dc:creator>
      <dc:date>2019-06-15T07:13:15Z</dc:date>
    </item>
  </channel>
</rss>

