<?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: How to find elapsed time between now() and event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221100#M188145</link>
    <description>&lt;P&gt;Your subtraction was probably right,  but it is no longer an epoch time after that but is instead a duration.  Something like the below may help,  and will give you a few keywords to search on if it is only close to your needs. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fieldformat timeField = tostring(timeField,"duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 06 Nov 2015 22:18:12 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2015-11-06T22:18:12Z</dc:date>
    <item>
      <title>How to find elapsed time between now() and event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221099#M188144</link>
      <description>&lt;P&gt;Hello.  I am trying to find the amount time that has passed from the time and event occurred to the present (now()).  I tried subtracting the time of the event from the current time, but I got an Epoch time value that gives me times in the 1970s.  What conversions do I have to make to have Splunk tell me something happened 30 hours ago and not 30 years?&lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 22:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221099#M188144</guid>
      <dc:creator>_dave_b</dc:creator>
      <dc:date>2015-11-06T22:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find elapsed time between now() and event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221100#M188145</link>
      <description>&lt;P&gt;Your subtraction was probably right,  but it is no longer an epoch time after that but is instead a duration.  Something like the below may help,  and will give you a few keywords to search on if it is only close to your needs. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fieldformat timeField = tostring(timeField,"duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Nov 2015 22:18:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221100#M188145</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-11-06T22:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to find elapsed time between now() and event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221101#M188146</link>
      <description>&lt;P&gt;Well you have the time of the event as _time field,  and you can use &lt;CODE&gt;now()&lt;/CODE&gt; in eval expressions, so you can make a field, let's call it secondsAgo, like so: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval secondsAgo=now() - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is of course just a number of seconds.  IF you were to do &lt;CODE&gt;| convert ctime(secondsAgo)&lt;/CODE&gt;, that would be weird because you're asking Splunk to tell you what time it would be if this number of seconds were defined as "the number of seconds since 1/1/1970 in GMT", which.... is generally a random time in 1970. &lt;/P&gt;

&lt;P&gt;What you probably want to do after getting secondsAgo as an integer,  is convert it to an "HH:MM:SS" duration string,  like so: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval secondsAgo=now() - _time | eval durationStr=tostring(secondsAgo,"duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or if you prefer it in one eval expression, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval secondsAgoStr=tostring(now() - _time, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Nov 2015 22:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221101#M188146</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2015-11-06T22:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to find elapsed time between now() and event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221102#M188147</link>
      <description>&lt;P&gt;Thanks!  I was not picking up on that important detail.  &lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 22:41:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221102#M188147</guid>
      <dc:creator>_dave_b</dc:creator>
      <dc:date>2015-11-06T22:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to find elapsed time between now() and event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221103#M188148</link>
      <description>&lt;P&gt;Thanks!  This is worthy of acceptance for the Answer, but rich7177 posted his Answer-acceptance worthy reply first, and therefore must get credit.  I hope my grattitude will suffice in lieu of Karma points!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 22:46:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221103#M188148</guid>
      <dc:creator>_dave_b</dc:creator>
      <dc:date>2015-11-06T22:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to find elapsed time between now() and event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221104#M188149</link>
      <description>&lt;P&gt;hehe.  Sure no problem.  He and I were writing our answers at the same time.   Unaccepting answers and accepting others happens all the time but in this case they are both right so it matters little.  Cheers. &lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 23:30:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-elapsed-time-between-now-and-event/m-p/221104#M188149</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2015-11-06T23:30:57Z</dc:date>
    </item>
  </channel>
</rss>

