<?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: Difference between Start and End Time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370783#M109109</link>
    <description>&lt;P&gt;Please show me sample log.&lt;/P&gt;

&lt;P&gt;|eval End_Time=substr(End_Time, 11, 9) | eval End_Time=&lt;STRONG&gt;strftime&lt;/STRONG&gt;(End_Time, "%H:%M:%S") &lt;BR /&gt;
|eval End_Time=substr(End_Time, 11, 9) | eval End_Time=&lt;STRONG&gt;strptime&lt;/STRONG&gt;(End_Time, "%H:%M:%S") &lt;BR /&gt;
However, because it is 9 digits, the format is different&lt;BR /&gt;
"%H:%M:%S"-&amp;gt;00:00:00 (8 digits)&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:48:48 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2020-09-29T16:48:48Z</dc:date>
    <item>
      <title>Difference between Start and End Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370780#M109106</link>
      <description>&lt;P&gt;I have a event, where starttime and endtime are coming as string. I am using below query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | transaction startswith="Start time for " endswith="End time for "|eval Start_Time=strftime(_time, "%H:%M;%S") | eval End_Time=substr(End_Time,11,9) | eval  Duration=strftime(duration,"%M:%S") | table Start_Time End_Time Duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With help of this query, I am able to get the right value for Start and End time, but duration is coming &lt;STRONG&gt;00:00&lt;/STRONG&gt; as both time are in different format. I Tried to convert both time in same format using &lt;STRONG&gt;convert function&lt;/STRONG&gt; but getting blank value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | transaction startswith="Start time for " endswith="End time for "|eval Start_Time=strftime(_time, "%H:%M;%S") | eval End_Time=substr(End_Time,11,9) | convert ctime(Start_Time) | convert ctime(End_Time) | eval  Duration=strftime(duration,"%M:%S") | table Start_Time End_Time Duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone help me to get the difference of Start and End time.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 04:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370780#M109106</guid>
      <dc:creator>twh1</dc:creator>
      <dc:date>2017-11-15T04:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between Start and End Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370781#M109107</link>
      <description>&lt;P&gt;Please convert End_Time to epoch time and calculate Duration.&lt;BR /&gt;
eval End_Time=strptime(End_Time,"your format")&lt;/P&gt;

&lt;P&gt;＞    | convert ctime(Start_Time) | convert ctime(End_Time) &lt;BR /&gt;
ctime needs an epoch time. Strings can not be used.&lt;/P&gt;

&lt;P&gt;＞    |eval Start_Time=strftime(_time, "%H:%M;%S")&lt;BR /&gt;
Start_Time：String&lt;BR /&gt;
_time：epoch time&lt;/P&gt;

&lt;P&gt;If duration is 00:00, check the _time of the transaction start and end logs.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:47:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370781#M109107</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T16:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between Start and End Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370782#M109108</link>
      <description>&lt;P&gt;I tried to convert format for End_Time but getting blank value for that field. I used below query now.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... "Start time for " |eval Start_Time=strftime(_time, "%H:%M:%S") |sort -Start_Time   | table  Start_Time | appendcols [ search ..... "End time for " |eval End_Time=substr(End_Time, 11, 9) | eval End_Time=strftime(End_Time, "%H:%M:%S") | eval Duration= End_Time
-Start_Time |sort -End_Time | table  End_Time ]  | table Start_Time End_Time Duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Nov 2017 06:01:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370782#M109108</guid>
      <dc:creator>twh1</dc:creator>
      <dc:date>2017-11-15T06:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between Start and End Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370783#M109109</link>
      <description>&lt;P&gt;Please show me sample log.&lt;/P&gt;

&lt;P&gt;|eval End_Time=substr(End_Time, 11, 9) | eval End_Time=&lt;STRONG&gt;strftime&lt;/STRONG&gt;(End_Time, "%H:%M:%S") &lt;BR /&gt;
|eval End_Time=substr(End_Time, 11, 9) | eval End_Time=&lt;STRONG&gt;strptime&lt;/STRONG&gt;(End_Time, "%H:%M:%S") &lt;BR /&gt;
However, because it is 9 digits, the format is different&lt;BR /&gt;
"%H:%M:%S"-&amp;gt;00:00:00 (8 digits)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:48:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-Start-and-End-Time/m-p/370783#M109109</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T16:48:48Z</dc:date>
    </item>
  </channel>
</rss>

