<?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 Find call duration in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303970#M91424</link>
    <description>&lt;P&gt;I am trying to find the amount of time people are on the phone to the help desk but are not getting any results back &lt;/P&gt;

&lt;P&gt;the input data CSV is below &lt;BR /&gt;
Call_Start_Time,Call_End_Time&lt;BR /&gt;
31/01/2016 23:32:13,31/01/2016 23:32:19&lt;/P&gt;

&lt;P&gt;what i would like to see is a table with call start time and call end time with how long the person was on the phone for &lt;/P&gt;

&lt;P&gt;the search i have been trying is &lt;BR /&gt;
source="SD_CallData2016.csv"  sourcetype="csv" &lt;BR /&gt;
 | eval StartTime=strptime(Call_Start_Time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;&lt;BR /&gt;
 | eval EndTime=strptime(Call_End_Time,"%Y-%m-%d %H:%M:%S") &lt;BR /&gt;
 | eval Duration=strftime(EndTime-StartTime,"%M:%S")&lt;BR /&gt;
| table StartTime EndTime Duration&lt;/P&gt;

&lt;P&gt;If anyone can help it would be appreciated &lt;BR /&gt;
Thanks&lt;BR /&gt;
Dan &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:57:10 GMT</pubDate>
    <dc:creator>DanielASG</dc:creator>
    <dc:date>2020-09-29T16:57:10Z</dc:date>
    <item>
      <title>Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303970#M91424</link>
      <description>&lt;P&gt;I am trying to find the amount of time people are on the phone to the help desk but are not getting any results back &lt;/P&gt;

&lt;P&gt;the input data CSV is below &lt;BR /&gt;
Call_Start_Time,Call_End_Time&lt;BR /&gt;
31/01/2016 23:32:13,31/01/2016 23:32:19&lt;/P&gt;

&lt;P&gt;what i would like to see is a table with call start time and call end time with how long the person was on the phone for &lt;/P&gt;

&lt;P&gt;the search i have been trying is &lt;BR /&gt;
source="SD_CallData2016.csv"  sourcetype="csv" &lt;BR /&gt;
 | eval StartTime=strptime(Call_Start_Time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;&lt;BR /&gt;
 | eval EndTime=strptime(Call_End_Time,"%Y-%m-%d %H:%M:%S") &lt;BR /&gt;
 | eval Duration=strftime(EndTime-StartTime,"%M:%S")&lt;BR /&gt;
| table StartTime EndTime Duration&lt;/P&gt;

&lt;P&gt;If anyone can help it would be appreciated &lt;BR /&gt;
Thanks&lt;BR /&gt;
Dan &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:57:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303970#M91424</guid>
      <dc:creator>DanielASG</dc:creator>
      <dc:date>2020-09-29T16:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303971#M91425</link>
      <description>&lt;P&gt;I think your Duration calculation is where your issue lies.  Try &lt;CODE&gt;| eval Duration=EndTime-StartTime&lt;/CODE&gt;.  I don't believe you can use strftime to translate seconds into hour/minute/second, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 03:57:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303971#M91425</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-27T03:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303972#M91426</link>
      <description>&lt;P&gt;thanks for the fast response&lt;/P&gt;

&lt;P&gt;I'm still getting nothing back &lt;/P&gt;

&lt;P&gt;the search I'm using now is&lt;BR /&gt;&lt;BR /&gt;
source="SD_CallData2016.csv" host="DRN" index="drn" sourcetype="csv" &lt;BR /&gt;
 | eval StartTime=strptime(Call_Start_Time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;&lt;BR /&gt;
 | eval EndTime=strptime(Call_End_Time,"%Y-%m-%d %H:%M:%S") &lt;BR /&gt;
| eval Duration=EndTime-StartTime&lt;BR /&gt;
| table StartTime EndTime Duration&lt;/P&gt;

&lt;P&gt;it looks like Splunk is not converting the time at all &lt;BR /&gt;
I'm starting to think my eval StartTime is wrong as well &lt;BR /&gt;
Thanks &lt;BR /&gt;
Dan &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:57:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303972#M91426</guid>
      <dc:creator>DanielASG</dc:creator>
      <dc:date>2020-09-29T16:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303973#M91427</link>
      <description>&lt;P&gt;Can you include an event (or more) from &lt;CODE&gt;source="SD_CallData2016.csv" host="DRN" index="drn" sourcetype="csv"&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 04:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303973#M91427</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-27T04:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303974#M91428</link>
      <description>&lt;P&gt;the data i can send out is below &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Call_Start_Time Call_End_Time  Call_Group   Location    Disposition &lt;/P&gt;

&lt;P&gt;1/01/2016 0:39:14   1/01/2016 0:44:31&lt;BR /&gt;
1/01/2016 0:46:02   1/01/2016 0:46:10&lt;BR /&gt;
1/01/2016 5:39:47   1/01/2016 5:45:08&lt;BR /&gt;
1/01/2016 6:22:31   1/01/2016 6:27:00&lt;BR /&gt;
1/01/2016 7:20:36   1/01/2016 7:24:14&lt;BR /&gt;
1/01/2016 8:22:51   1/01/2016 8:29:29&lt;BR /&gt;
1/01/2016 8:29:13   1/01/2016 8:29:48&lt;BR /&gt;
1/01/2016 8:33:13   1/01/2016 8:39:40&lt;BR /&gt;
1/01/2016 8:36:31   1/01/2016 8:40:28&lt;BR /&gt;
1/01/2016 8:48:35   1/01/2016 8:57:18&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:57:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303974#M91428</guid>
      <dc:creator>DanielASG</dc:creator>
      <dc:date>2020-09-29T16:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303975#M91429</link>
      <description>&lt;P&gt;got it to work &lt;/P&gt;

&lt;P&gt;source="SD_CallData2016.csv" host="DRN" index="drn" sourcetype="csv" &lt;BR /&gt;
 | eval start= strptime(Call_Start_Time,"%d/%m/%Y %H:%M:%S")&lt;BR /&gt;
 | eval end= strptime(Call_End_Time,"%d/%m/%Y %H:%M:%S")&lt;BR /&gt;
 | eval diff= end-start&lt;BR /&gt;
 | table Call_Start_Time Call_End_Time diff&lt;/P&gt;

&lt;P&gt;I was putting in the wrong date string &lt;/P&gt;

&lt;P&gt;thanks for you help &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:57:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303975#M91429</guid>
      <dc:creator>DanielASG</dc:creator>
      <dc:date>2020-09-29T16:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303976#M91430</link>
      <description>&lt;P&gt;@micahkemp - Yes, you can use &lt;CODE&gt;strftime()&lt;/CODE&gt; like that.  The problem, that the OP has correctly fixed, is that the translations of time format to epoch via &lt;CODE&gt;strptime()&lt;/CODE&gt; needed to occur correctly before the mathematical calculation of duration.  Please correct your post so that it won't confuse folks.  &lt;/P&gt;

&lt;P&gt;Run anywhere sample code - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval duration=123 | eval myMin = strftime(duration,"%M:%S") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 06:00:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303976#M91430</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-27T06:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303977#M91431</link>
      <description>&lt;P&gt;Actually, I'm not sure that's working as you expect.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval duration=3601 | eval myMin = strftime(duration,"%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Considering the format string one would probably expect (or at least hope) that the result would be &lt;CODE&gt;60:01&lt;/CODE&gt;, yet it is &lt;CODE&gt;00:01&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I believe that &lt;CODE&gt;strftime&lt;/CODE&gt; is just handling &lt;CODE&gt;duration&lt;/CODE&gt; as if it were an epoch time, and therefore will only work if your duration isn't longer than your format string can handle without overflow.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 13:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303977#M91431</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-27T13:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Find call duration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303978#M91432</link>
      <description>&lt;P&gt;Yes, if you expect times over an hour then you'd have to do one of these...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval duration=3601 
| eval myMin1 = strftime(duration,"%H:%M:%S")
| eval myMin2 = floor(duration/60,0).strftime(duration,":%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But then you could make the same argument at the next level for hours or days.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval duration2=90001 
| eval myMin3 = floor(duration2/3600).strftime(duration,":%M:%S")
| eval myMin4 = floor(duration2/86400)." ".strftime(duration,"%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 17:13:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-call-duration/m-p/303978#M91432</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-27T17:13:39Z</dc:date>
    </item>
  </channel>
</rss>

