<?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 do I report on timestamps for earliest and latest field values for multiple events in a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183426#M52806</link>
    <description>&lt;P&gt;I have a list of logs that are relevant to a specific sourcetype and serial Number. My search results in the following types of logs which have mutiple phase values. My logs look like the following and naturally show up in chronological order (latest first) from the search query:&lt;/P&gt;

&lt;P&gt;Search: sourcetype="loglist" serialnum="n1234" segmentid="15" &lt;/P&gt;

&lt;P&gt;Logs:&lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="precall", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="callexcept", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="precall", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="callresult", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="precall", &lt;/P&gt;

&lt;P&gt;I'm interested in getting (1) the timestamps and (2) the duration for the earliest or latest combination of precall and callresult logs. i.e., the time difference between the earliest log with phase="precall" and earliest log with phase="callresult". I would like to be able to (2) repeat this with the latest combinations and (2) scale this query to all serialnumbers and their corresponding segmentids within the sourcetype.&lt;/P&gt;

&lt;P&gt;I tried this:&lt;BR /&gt;
sourcetype="loglist" serialnum="N1234" segmentid="15"| stats earliest(eval(phase="precall")) as d1 earliest(eval(phase="callresult")) as d2| eval k1=d1 | eval k2=d2| transaction startswith(k1) endswith (k2) | table duration&lt;/P&gt;

&lt;P&gt;Splunk identifies the events, but it's unable to perform any calculations on it. I'm basically trying to assign the earliest precall and callresult logs to a new field so that I can calculate duration based of that. Any thoughts on how I can modify this search would help! Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 08 May 2015 00:52:49 GMT</pubDate>
    <dc:creator>aramakrishnan</dc:creator>
    <dc:date>2015-05-08T00:52:49Z</dc:date>
    <item>
      <title>How do I report on timestamps for earliest and latest field values for multiple events in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183426#M52806</link>
      <description>&lt;P&gt;I have a list of logs that are relevant to a specific sourcetype and serial Number. My search results in the following types of logs which have mutiple phase values. My logs look like the following and naturally show up in chronological order (latest first) from the search query:&lt;/P&gt;

&lt;P&gt;Search: sourcetype="loglist" serialnum="n1234" segmentid="15" &lt;/P&gt;

&lt;P&gt;Logs:&lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="precall", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="callexcept", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="precall", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="callresult", &lt;BR /&gt;
...serialnum="n1234"..."segmentid=15", host="abcd", phase="precall", &lt;/P&gt;

&lt;P&gt;I'm interested in getting (1) the timestamps and (2) the duration for the earliest or latest combination of precall and callresult logs. i.e., the time difference between the earliest log with phase="precall" and earliest log with phase="callresult". I would like to be able to (2) repeat this with the latest combinations and (2) scale this query to all serialnumbers and their corresponding segmentids within the sourcetype.&lt;/P&gt;

&lt;P&gt;I tried this:&lt;BR /&gt;
sourcetype="loglist" serialnum="N1234" segmentid="15"| stats earliest(eval(phase="precall")) as d1 earliest(eval(phase="callresult")) as d2| eval k1=d1 | eval k2=d2| transaction startswith(k1) endswith (k2) | table duration&lt;/P&gt;

&lt;P&gt;Splunk identifies the events, but it's unable to perform any calculations on it. I'm basically trying to assign the earliest precall and callresult logs to a new field so that I can calculate duration based of that. Any thoughts on how I can modify this search would help! Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2015 00:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183426#M52806</guid>
      <dc:creator>aramakrishnan</dc:creator>
      <dc:date>2015-05-08T00:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I report on timestamps for earliest and latest field values for multiple events in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183427#M52807</link>
      <description>&lt;P&gt;Right now, you're using &lt;CODE&gt;stats&lt;/CODE&gt; which gathers everything up into buckets as designated. What it sounds like you are looking for is THE earliest as a single value and then do something with that value... so you want &lt;CODE&gt;streamstats&lt;/CODE&gt;. it uses the same functions.&lt;/P&gt;

&lt;P&gt;If that doesn't do it for you or at least make sense... you might want to explain the statement "unable to perform any calculations on it". Like what?&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2015 05:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183427#M52807</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-05-08T05:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I report on timestamps for earliest and latest field values for multiple events in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183428#M52808</link>
      <description>&lt;P&gt;This should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="loglist" | stats earliest(eval(phase="precall")) as d1 earliest(eval(phase="callresult")) as d2 by serialnum,segmentid | eval duration=d2-d1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 May 2015 14:37:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-report-on-timestamps-for-earliest-and-latest-field/m-p/183428#M52808</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-08T14:37:08Z</dc:date>
    </item>
  </channel>
</rss>

