<?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: Time Conversion - Elapsed Time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333324#M160893</link>
    <description>&lt;P&gt;I wanted to display the duration in sections for example the output will be:&lt;BR /&gt;
8d+18H:30M:28S&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2019 17:52:12 GMT</pubDate>
    <dc:creator>tegaslink</dc:creator>
    <dc:date>2019-09-26T17:52:12Z</dc:date>
    <item>
      <title>Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333313#M160882</link>
      <description>&lt;P&gt;I have time stamps in the format of H:MM.  But when the minutes reach 60 they don't add an hour only when the number reaching above .99 does it add an hour.&lt;/P&gt;

&lt;P&gt;This makes the timestamp hard to read.&lt;/P&gt;

&lt;P&gt;What complicates the issue is that the elapsed time can be anywhere from .22 to 3.22.&lt;/P&gt;

&lt;P&gt;I'm calculating these elapsed times from two correctly formatted time stamps, converting those to seconds, subtracting them then converting back to normal time.  I've tried if and case evals but they aren't always correct.&lt;/P&gt;

&lt;P&gt;Has anyone found a solution to a problem similar to this?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:10:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333313#M160882</guid>
      <dc:creator>jordanb93</dc:creator>
      <dc:date>2017-06-01T16:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333314#M160883</link>
      <description>&lt;P&gt;How are you doing the "converting back to normal time" part?  Are you using &lt;CODE&gt;strftime&lt;/CODE&gt; or &lt;CODE&gt;tostring(seconds,"duration")&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 17:52:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333314#M160883</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-01T17:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333315#M160884</link>
      <description>&lt;P&gt;Is Splunk parsing the data correctly? Is the _time field the correct time? If so maybe you can just use that. If not you'll have to get fancy with eval commands to convert the time stamp yourself.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 01:23:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333315#M160884</guid>
      <dc:creator>pappjr</dc:creator>
      <dc:date>2017-06-02T01:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333316#M160885</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval DurationInSeconds=234.76 | eval DurationDisplay=strftime(DurationInSeconds,"%H:%M:%S.%3N")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Jun 2017 01:49:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333316#M160885</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-02T01:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333317#M160886</link>
      <description>&lt;P&gt;eval DurationDisplay=strftime(differenceEpoch,"%H:%M:%S")&lt;/P&gt;

&lt;P&gt;The issue is that the calculation is close to being correct.  From my data i'll have a timestamp like 21:20:00 and 20:00:00 i need to calculate the difference between these numbers.  What would return in this case is something like 19:20:00.  For some reason it will have 18 in the hour space when it should be 0.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:24:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333317#M160886</guid>
      <dc:creator>jordanb93</dc:creator>
      <dc:date>2017-06-05T13:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333318#M160887</link>
      <description>&lt;P&gt;The issue is that the calculation is close to being correct. From my data i'll have a timestamp like 21:20:00 and 20:00:00 i need to calculate the difference between these numbers. What would return in this case is something like 19:20:00. For some reason it will have 18 in the hour space when it should be 0.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:26:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333318#M160887</guid>
      <dc:creator>jordanb93</dc:creator>
      <dc:date>2017-06-05T13:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333319#M160888</link>
      <description>&lt;P&gt;try using tostring instead of strftime. strftime is more for a datestamp since it's using epoch and tostring is for actual seconds duration:&lt;/P&gt;

&lt;P&gt;this got me 1 hour and 20 minutes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults |eval starttime="21:20:00"|eval endtime="20:00:00"|eval secondsstart=strptime(starttime,"%H:%M:%S")|eval secondsend=strptime(endtime,"%H:%M:%S")|eval durationseconds=secondsstart-secondsend|eval duration=mvindex(split(tostring(durationseconds,"duration"),"."),0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jun 2017 14:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333319#M160888</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-06-05T14:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333320#M160889</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval times="21:20:00,20:00:00 20:00:00,21:20:00" | makemv times | mvexpand times | makemv delim="," times | eval starttime=mvindex(times,0), endtime=mvindex(times,1) | table starttime endtime
| rename COMMENT as "The above just generates test data."

| eval startepoch=strptime(starttime,"%H:%M:%S"), endepoch=strptime(endtime,"%H:%M:%S")
| eval endepoch=if(endepoch&amp;lt;startepoch,endepoch+86400,endepoch)
| eval durationepoch=endepoch-startepoch
| eval duration=strftime(durationepoch,"%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2017 15:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333320#M160889</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-08T15:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333321#M160890</link>
      <description>&lt;P&gt;@cmerriman i used the solution you provided "(split(tostring(durationseconds,"duration"),"."),0)"&lt;BR /&gt;
but this came out with very weird answers. I got answers like &lt;BR /&gt;
6+02:23:16  9+03:34:54&lt;BR /&gt;
4+08:55:02  6+13:22:33&lt;BR /&gt;
5+20:20:19  8+18:30:28&lt;BR /&gt;
&lt;STRONG&gt;5+20:20:19    8+18:30:28&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I don't know how to explain  8 + 18:30:28 , where do i fit that. do i have to do more computation to sum that up again. I don't really see a documentation on SPLUNK's Docs for all of this, nothing covers how to calculate duration or the answers to expect after this is being used. &lt;BR /&gt;
Please explain this process to me, it is really vague&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2019 03:44:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333321#M160890</guid>
      <dc:creator>tegaslink</dc:creator>
      <dc:date>2019-09-22T03:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333322#M160891</link>
      <description>&lt;P&gt;The 8+ is referring to the number of days. How exactly are you wanting to display duration?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2019 15:05:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333322#M160891</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2019-09-22T15:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333323#M160892</link>
      <description>&lt;P&gt;does this also apply if you utlize the _time in the stats?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 14:09:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333323#M160892</guid>
      <dc:creator>reneedeleon</dc:creator>
      <dc:date>2019-09-26T14:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333324#M160893</link>
      <description>&lt;P&gt;I wanted to display the duration in sections for example the output will be:&lt;BR /&gt;
8d+18H:30M:28S&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 17:52:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333324#M160893</guid>
      <dc:creator>tegaslink</dc:creator>
      <dc:date>2019-09-26T17:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333325#M160894</link>
      <description>&lt;P&gt;you can try something like this: &lt;CODE&gt;|eval dur2=floor(time/86400)."d+".floor(time/3600)."H:".(floor(time/60)%60)."M:".floor(time%60)."S"&lt;/CODE&gt;&lt;BR /&gt;
but generally the duration is doing what you want, without adding the d/H/M/S values.&lt;/P&gt;

&lt;P&gt;8+18:30:28 means 8 days, 18 hours, 30 minutes, and 28 seconds.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 23:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333325#M160894</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2019-09-26T23:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion - Elapsed Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333326#M160895</link>
      <description>&lt;P&gt;That's solid. It worked!&lt;BR /&gt;
Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 22:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-Elapsed-Time/m-p/333326#M160895</guid>
      <dc:creator>tegaslink</dc:creator>
      <dc:date>2019-10-02T22:10:11Z</dc:date>
    </item>
  </channel>
</rss>

