<?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 convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282334#M85244</link>
    <description>&lt;P&gt;there is no Day info.. I was able to get to epoc time... question is how can I convert epoc time to seconds...&lt;/P&gt;

&lt;P&gt;field - 00:00:05 &lt;BR /&gt;
epoc - 16959+05:00:05.000000&lt;BR /&gt;&lt;BR /&gt;
seconds - 5 ? &lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2016 19:54:51 GMT</pubDate>
    <dc:creator>vchitrala</dc:creator>
    <dc:date>2016-06-07T19:54:51Z</dc:date>
    <item>
      <title>How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282326#M85236</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have an interesting issue. My logs include format such as Day:Hour:Min:Sec. I need to strip out hour from logs and calculate the entire duration in seconds. How can I achieve it? I tried to include Day in calculation, but It's not working, so want to convert this to string and strip off day part. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;More information:&lt;/STRONG&gt;&lt;BR /&gt;
I have a time format - 0:00:00:05 &lt;BR /&gt;
I was able to convert it to string - 00:00:05 &lt;BR /&gt;
&lt;CODE&gt;eval time=strptime(test2,"%H:%M:%S")&lt;/CODE&gt; - gave me 1465275605.000000 &lt;BR /&gt;
I need to convert this to duration in seconds. - 5 seconds&lt;/P&gt;

&lt;P&gt;This is my search string so far: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval test = tostring(JobStepsExecutionDuration) | eval test2 = substr(test,3,8) | eval time=strptime(test2,"%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 18:49:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282326#M85236</guid>
      <dc:creator>vchitrala</dc:creator>
      <dc:date>2016-06-06T18:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282327#M85237</link>
      <description>&lt;P&gt;Have you tried one of these converions, specifically the &lt;CODE&gt;dur2sec()&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.7/SearchReference/Convert"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.7/SearchReference/Convert&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 19:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282327#M85237</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-06T19:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282328#M85238</link>
      <description>&lt;P&gt;Can you provide sample logs and example of what you're trying to do? &lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 22:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282328#M85238</guid>
      <dc:creator>Masa</dc:creator>
      <dc:date>2016-06-06T22:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282329#M85239</link>
      <description>&lt;P&gt;Hi , I tried but it's not working out..&lt;BR /&gt;
so want to strip off Day part and try to convert it to time in terms of HH:MM:SS &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 17:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282329#M85239</guid>
      <dc:creator>vchitrala</dc:creator>
      <dc:date>2016-06-07T17:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282330#M85240</link>
      <description>&lt;P&gt;Maybe you can try to change format of the JobStepsExecustionDuration to meet dur2sec() requirement&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt;  | rex field=JobStepsExecutionDuration mode=sed "s/^([^:]+)(:)/\1+/" | convert dur2sec(JobStepsExecutionDuration)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested this with the following search and it worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval JobStepsExecutionDuration="0:00:00:05" | rex field=JobStepsExecutionDuration mode=sed "s/^([^:]+)(:)/\1+/" | convert dur2sec(JobStepsExecutionDuration)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2016 19:18:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282330#M85240</guid>
      <dc:creator>Masa</dc:creator>
      <dc:date>2016-06-07T19:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282331#M85241</link>
      <description>&lt;P&gt;Convert it with rex...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=JobStepsExecutionDuration "(?&amp;lt;hh&amp;gt;\d+):(?&amp;lt;mm&amp;gt;\d+):(?&amp;lt;ms&amp;gt;\d+)" | eval dur = (hh * 3600) + (mm * 60) + dd | table JobStepsExecutionDuration dur
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2016 19:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282331#M85241</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-07T19:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282332#M85242</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;rex field=time mode=sed "s/^([^:]+)(:)/\1+/" | convert dur2sec(time) AS seconds 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get seconds as  &lt;/P&gt;

&lt;P&gt;jobstepduration     seconds                                        I need &lt;BR /&gt;
00:00:05               1465275605.000000                         5&lt;BR /&gt;
00:00:22               1465275622.000000                         22&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 19:38:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282332#M85242</guid>
      <dc:creator>vchitrala</dc:creator>
      <dc:date>2016-06-07T19:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282333#M85243</link>
      <description>&lt;P&gt;Maybe you want to add day information, too. Well, this person is not looking for the value... &lt;BR /&gt;
Without dur2sec() function, this could be a solution. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 19:42:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282333#M85243</guid>
      <dc:creator>Masa</dc:creator>
      <dc:date>2016-06-07T19:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282334#M85244</link>
      <description>&lt;P&gt;there is no Day info.. I was able to get to epoc time... question is how can I convert epoc time to seconds...&lt;/P&gt;

&lt;P&gt;field - 00:00:05 &lt;BR /&gt;
epoc - 16959+05:00:05.000000&lt;BR /&gt;&lt;BR /&gt;
seconds - 5 ? &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 19:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282334#M85244</guid>
      <dc:creator>vchitrala</dc:creator>
      <dc:date>2016-06-07T19:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282335#M85245</link>
      <description>&lt;P&gt;It worked.. turned out to be far simpler than I thought... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval  test = tostring(JobStepsExecutionDuration) |  eval test2 = substr(test,3,8) || convert dur2sec(test2)  As Durationseconds 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jun 2016 20:10:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282335#M85245</guid>
      <dc:creator>vchitrala</dc:creator>
      <dc:date>2016-06-07T20:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282336#M85246</link>
      <description>&lt;P&gt;Great. We got confused with your question and what you're looking for.&lt;/P&gt;

&lt;P&gt;So, the value is not &lt;STRONG&gt;Duration&lt;/STRONG&gt;.  It is date time information in epoch time in seconds. &lt;/P&gt;

&lt;P&gt;Please keep in mind that the result will be changed tomorrow because the string is assuming date information. &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 20:14:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282336#M85246</guid>
      <dc:creator>Masa</dc:creator>
      <dc:date>2016-06-07T20:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert time format 0:00:00:00 into a string and later to time to calculate duration in seconds?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282337#M85247</link>
      <description>&lt;P&gt;Works great for my dashboard!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 15:51:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-time-format-0-00-00-00-into-a-string-and-later-to/m-p/282337#M85247</guid>
      <dc:creator>tcupp</dc:creator>
      <dc:date>2018-08-14T15:51:26Z</dc:date>
    </item>
  </channel>
</rss>

