<?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 calculate the difference between two timestamps to get the duration of a video call? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314532#M162700</link>
    <description>&lt;P&gt;I have never created a field in Splunk, I know how to create an event type, a field seems little different to me.&lt;/P&gt;</description>
    <pubDate>Sun, 04 Mar 2018 23:24:05 GMT</pubDate>
    <dc:creator>murat89</dc:creator>
    <dc:date>2018-03-04T23:24:05Z</dc:date>
    <item>
      <title>How to calculate the difference between two timestamps to get the duration of a video call?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314527#M162695</link>
      <description>&lt;P&gt;Hi guys, &lt;/P&gt;

&lt;P&gt;im a beginner in Splunk and my issue is that I have Cisco logs and I need to find out the conference duration but there is no field like duration so I have to make it through timestamps. &lt;BR /&gt;
Below you can see that kind of log and I don't know how to get the timestamps and then calculate the difference between them, please help, im thankful for any idea. &lt;/P&gt;

&lt;P&gt;Just a part of Cisco log:&lt;BR /&gt;
2814 2018/01/22 09:56:39.008 APP                      Info      conference "Terminal 1" created&lt;BR /&gt;
2846 2018/01/22 12:01:30.213 APP                      Info      conference "Terminal 1":  deleted via API (no participants)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 20:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314527#M162695</guid>
      <dc:creator>murat89</dc:creator>
      <dc:date>2018-02-27T20:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two timestamps to get the duration of a video call?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314528#M162696</link>
      <description>&lt;P&gt;Best (in terms of performance) is to use stats on a field (or group of fields), preferably a primary key which is common between both type of events (conference start and end) and can uniquely identify the conference. For example, if there is field call conference_id in your logs, you can do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YourIndex sourcetype=YourCiscoSourcetype (conference created) OR (conference deleted)
| eval confStart=if(searchmatch("conference created"),"_time,null())
| eval confEnd=if(searchmatch("conference deleted"),"_time,null())
| stats values(confStart) as confStart values(confEnd) as confEnd by conference_id
| eval "duration(in secs)"=confEnd-confStart
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Feb 2018 20:46:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314528#M162696</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-27T20:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two timestamps to get the duration of a video call?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314529#M162697</link>
      <description>&lt;P&gt;Thank you, great solution, i really appreciate that. Unfortunately there is no conference_id but we do have the conference name, here it is "Terminal 1". How to do with that? &lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 10:43:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314529#M162697</guid>
      <dc:creator>murat89</dc:creator>
      <dc:date>2018-02-28T10:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two timestamps to get the duration of a video call?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314530#M162698</link>
      <description>&lt;P&gt;Extract the data where the name is to a field called conference_name and change out the by conference_id.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314530#M162698</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2020-09-29T18:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two timestamps to get the duration of a video call?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314531#M162699</link>
      <description>&lt;P&gt;@murat89, based on the sample data provided please try the following run anywhere search.&lt;/P&gt;

&lt;P&gt;PS: First 5 pipes from &lt;CODE&gt;makeresults&lt;/CODE&gt; to &lt;CODE&gt;rename&lt;/CODE&gt; are used to generate the mock data. Also while I have extracted &lt;CODE&gt;_time&lt;/CODE&gt; using rex, you might need the rex command from &lt;CODE&gt;APP Info conference&lt;/CODE&gt; onward as your data will have timestamp extracted already.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval data="2814 2018/01/22 09:56:39.008 APP Info conference \"Terminal 1\" created;2846 2018/01/22 12:01:30.213 APP Info conference \"Terminal 1\": deleted via API (no participants)"
| makemv data delim=";" 
| mvexpand data
| rename data as _raw
| rex "\d{4}\s(?&amp;lt;_time&amp;gt;\d{4}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2}.\d{3})\sAPP Info conference\s\"(?&amp;lt;id&amp;gt;[^\"]+)\"(\s|\:)+(?&amp;lt;status&amp;gt;\w+)"
| eval _time=strptime(_time,"%Y/%m/%d %H:%M:%S.%3N")
| stats first(_time) as _time last(_time) as EndTime values(status) as status by id
| search status=created AND status=deleted
| eval duration=EndTime-_time
| fields - EndTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Mar 2018 18:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314531#M162699</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-04T18:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two timestamps to get the duration of a video call?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314532#M162700</link>
      <description>&lt;P&gt;I have never created a field in Splunk, I know how to create an event type, a field seems little different to me.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 23:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-timestamps-to-get/m-p/314532#M162700</guid>
      <dc:creator>murat89</dc:creator>
      <dc:date>2018-03-04T23:24:05Z</dc:date>
    </item>
  </channel>
</rss>

