<?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 Using an earliest_time and latest_time parameter, can the output be the amount of time between these 2 events? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299417#M56631</link>
    <description>&lt;P&gt;Hi All&lt;BR /&gt;
I want to extract result for period of co-relation rule i.e:&lt;/P&gt;

&lt;P&gt;"dispatch.earliest_time" - "dispatch.latest_time"&lt;/P&gt;

&lt;P&gt;Example : &lt;BR /&gt;
dispatch.earliest_time = &lt;EM&gt;"63m@m"&lt;/EM&gt;&lt;BR /&gt;
dispatch.latest_time = &lt;EM&gt;"3m"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Required result is  &lt;STRONG&gt;"63m@m" - "3m" = 60m&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 15:30:00 GMT</pubDate>
    <dc:creator>sumanssah</dc:creator>
    <dc:date>2020-09-29T15:30:00Z</dc:date>
    <item>
      <title>Using an earliest_time and latest_time parameter, can the output be the amount of time between these 2 events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299417#M56631</link>
      <description>&lt;P&gt;Hi All&lt;BR /&gt;
I want to extract result for period of co-relation rule i.e:&lt;/P&gt;

&lt;P&gt;"dispatch.earliest_time" - "dispatch.latest_time"&lt;/P&gt;

&lt;P&gt;Example : &lt;BR /&gt;
dispatch.earliest_time = &lt;EM&gt;"63m@m"&lt;/EM&gt;&lt;BR /&gt;
dispatch.latest_time = &lt;EM&gt;"3m"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Required result is  &lt;STRONG&gt;"63m@m" - "3m" = 60m&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299417#M56631</guid>
      <dc:creator>sumanssah</dc:creator>
      <dc:date>2020-09-29T15:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using an earliest_time and latest_time parameter, can the output be the amount of time between these 2 events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299418#M56632</link>
      <description>&lt;P&gt;If you are doing it inside a search, you can do this to get the range in seconds between earliest and latest for the search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| addinfo
| eval result = info_max_time - info_min_time 
| eval resultMin = round(result/60)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Aug 2017 23:46:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299418#M56632</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-23T23:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using an earliest_time and latest_time parameter, can the output be the amount of time between these 2 events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299419#M56633</link>
      <description>&lt;P&gt;Thanks for response.&lt;BR /&gt;
I tried you suggestion, however getting below mentioned error&lt;/P&gt;

&lt;P&gt;Error in 'eval' command: Typechecking failed. '-' only takes numbers.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 07:36:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299419#M56633</guid>
      <dc:creator>sumanssah</dc:creator>
      <dc:date>2017-08-24T07:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using an earliest_time and latest_time parameter, can the output be the amount of time between these 2 events?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299420#M56634</link>
      <description>&lt;P&gt;That's because you have no upper bound on the time, so info_max_time has a value that is represented as "+infinity".  I've added &lt;CODE&gt;makeresults&lt;/CODE&gt; onto the front for testing.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults 
 | addinfo
 | eval result = if(isnum(info_max_time),info_max_time,now()) - info_min_time  
 | eval resultMin = round(result/60)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above assumes there are no future-dated transactions in the results.  If future-dated events are possible, then you can do something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults 
 | eval _time = relative_time(_time,"+2d@d")
 | rename COMMENT as "The above just creates test data with future dates."

 | rename COMMENT as "Get the highest event date/time, and get the time range from the search."
 | eventstats max(_time) as maxtime 
 | addinfo
 | rename COMMENT as "Calculate time range from the search (if not all time), using the maximum event _time if it is future , else use now()."
 | eval result = case(isnum(info_max_time),info_max_time,  maxtime&amp;gt;now(),maxtime,  true(),now()) - info_min_time  
 | eval resultMin = round(result/60)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-an-earliest-time-and-latest-time-parameter-can-the-output/m-p/299420#M56634</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-09-29T15:25:51Z</dc:date>
    </item>
  </channel>
</rss>

