<?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: Get fields associated with the earliest event in a search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493934#M137715</link>
    <description>&lt;P&gt;The problem with &lt;CODE&gt;stats&lt;/CODE&gt; as it's used here is it discards all fields except those it uses.  In this case, it means only the FirstEvent field is available to later commands.  To get the other fields from the events, you must include them in the &lt;CODE&gt;stats&lt;/CODE&gt; command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(_time) as FirstEvent. values(*) as *
| addinfo 
| eval duration=(FirstEvent - info_min_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 May 2020 15:09:12 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-05-12T15:09:12Z</dc:date>
    <item>
      <title>Get fields associated with the earliest event in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493933#M137714</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I am still a Splunk novice but I am looking for some help using the earliest command. I am calculating a duration from the beginning of my search period to the first event in the search period. For example, lets say the time frame is from 08:00 - 09:00 and the first event is seen at 08:15. This is my code :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(_time) as FirstEvent
| addinfo 
| eval duration=(FirstEvent - info_min_time)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I am, able to get the timestamp of the earliest event at 08:15 BUT I would also like to get the fields associated with that earliest event. I have tried using two earliest commands but one overrides the other. In short, how do I get the fields associated with the (earliest) 08:15 event? &lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 14:19:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493933#M137714</guid>
      <dc:creator>aaloisi</dc:creator>
      <dc:date>2020-05-12T14:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields associated with the earliest event in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493934#M137715</link>
      <description>&lt;P&gt;The problem with &lt;CODE&gt;stats&lt;/CODE&gt; as it's used here is it discards all fields except those it uses.  In this case, it means only the FirstEvent field is available to later commands.  To get the other fields from the events, you must include them in the &lt;CODE&gt;stats&lt;/CODE&gt; command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(_time) as FirstEvent. values(*) as *
| addinfo 
| eval duration=(FirstEvent - info_min_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2020 15:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493934#M137715</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-12T15:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields associated with the earliest event in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493935#M137716</link>
      <description>&lt;P&gt;So adding the "values" to the stats gets really close to what I need but not exactly. Values returns a list of the distinct values of field X. In my case there are 2 distinct values. I want the current value of field X at time=earliest (08:15).&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 18:02:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493935#M137716</guid>
      <dc:creator>aaloisi</dc:creator>
      <dc:date>2020-05-12T18:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields associated with the earliest event in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493936#M137717</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;earliest&lt;/CODE&gt; instead of &lt;CODE&gt;values&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 18:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493936#M137717</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-12T18:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get fields associated with the earliest event in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493937#M137718</link>
      <description>&lt;P&gt;Thanks @richgalloway this is exactly what I needed! &lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 12:48:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-fields-associated-with-the-earliest-event-in-a-search/m-p/493937#M137718</guid>
      <dc:creator>aaloisi</dc:creator>
      <dc:date>2020-05-14T12:48:38Z</dc:date>
    </item>
  </channel>
</rss>

