<?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: Calculating time difference in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612294#M212887</link>
    <description>&lt;P&gt;did you edit your first comment.... I'm getting same results&amp;nbsp;&lt;BR /&gt;can you post the corrected query?&amp;nbsp;&lt;BR /&gt;Appreciate.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Sep 2022 16:45:45 GMT</pubDate>
    <dc:creator>EvansB</dc:creator>
    <dc:date>2022-09-07T16:45:45Z</dc:date>
    <item>
      <title>How to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612280#M212879</link>
      <description>&lt;P&gt;I'm looking to get a&lt;SPAN&gt;&amp;nbsp;difference between both times and create a 3rd field for the results (Properties.actionedDate - _time). My current query is like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=* source=* | table Properties.actionedDate, _time&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Here is a screenshot of my current result&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EvansB_0-1662563212282.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21362i9BB41C5F7B3550F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EvansB_0-1662563212282.png" alt="EvansB_0-1662563212282.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 15:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612280#M212879</guid>
      <dc:creator>EvansB</dc:creator>
      <dc:date>2022-09-07T15:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612282#M212880</link>
      <description>&lt;P&gt;I probably should make this a macro since I give this answer a lot.&amp;nbsp; Timestamps must be in epoch (integer) format to be compared or to find their difference.&amp;nbsp; Use the &lt;FONT face="courier new,courier"&gt;strptime&lt;/FONT&gt; function for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* source=* 
| rename Properties.actionedDate as actionedDate
| eval actionedTS = strptime(, "%Y-%m-%dT%H:%M:%S.%7N%:z")
| eval diff = _time - actionedTS
| table actionedDate, _time, diff&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 18:02:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612282#M212880</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-07T18:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612288#M212883</link>
      <description>&lt;P&gt;Thanks for your response.&lt;BR /&gt;This should work but I'm not getting results on the diff field - (I sorted with this field)&lt;BR /&gt;Does that mean there are no difference between timestamps and _time?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EvansB_0-1662565524803.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21364i32FA0FCC5F3A959F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EvansB_0-1662565524803.png" alt="EvansB_0-1662565524803.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 15:45:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612288#M212883</guid>
      <dc:creator>EvansB</dc:creator>
      <dc:date>2022-09-07T15:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612292#M212885</link>
      <description>&lt;P&gt;I noticed a typo in the &lt;FONT face="courier new,courier"&gt;strptime&lt;/FONT&gt; format string in my reply, which I've corrected.&amp;nbsp; I also added a &lt;FONT face="courier new,courier"&gt;rename&lt;/FONT&gt; command in case &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; doesn't like the original field name.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 16:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612292#M212885</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-07T16:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612294#M212887</link>
      <description>&lt;P&gt;did you edit your first comment.... I'm getting same results&amp;nbsp;&lt;BR /&gt;can you post the corrected query?&amp;nbsp;&lt;BR /&gt;Appreciate.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 16:45:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612294#M212887</guid>
      <dc:creator>EvansB</dc:creator>
      <dc:date>2022-09-07T16:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612305#M212892</link>
      <description>&lt;P&gt;I don't know what happened to my original edit, but I've re-posted it.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 18:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612305#M212892</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-07T18:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612310#M212893</link>
      <description>&lt;P&gt;I eventually used this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* source=*
| rename Properties.actionedDate as actionedDate
| eval actionedTS = strptime(actionedDate, "%Y-%m-%dT%H:%M:%S.%7N%:z")
| eval diff = _time - actionedTS 
| table actionedDate, _time, diff&lt;/LI-CODE&gt;&lt;P&gt;Appreciate you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 19:54:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/612310#M212893</guid>
      <dc:creator>EvansB</dc:creator>
      <dc:date>2022-09-07T19:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate time difference?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/676145#M231285</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;,&amp;nbsp;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168" target="_blank"&gt;@ITWhisperer&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have similar doubt but little tedious:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Use case:&lt;SPAN&gt;In my org primarily Mission Control events are investigated by&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SOC&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;as soon as they pop up, if futher investigation is needed the incident is escalated to&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Enterprise security TEAM&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;who is responsible to perform deeper/detailed investigation and update back in Mission Control.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;USE CASE:&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The enterprise security manger wants a DASHBOARD which will inform him about :&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if the investigation is being performed by his team (ES)&amp;gt; how much average time his team member takes to resolve an incident &lt;STRONG&gt;(for now I'm only focusing on this)&lt;/STRONG&gt;&amp;gt; averaged over a month.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;jeff is ES resource&amp;nbsp; &amp;amp; stephen is SOC resource&amp;nbsp;&lt;BR /&gt;i want to pick end_time where resource is Stephen and notes is "Escalation to ES" and start_time where resource is jeff and subtract them in order to get claim_time_by_ES.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;SO far the query I'm using but not successful yet is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mcincidents unwind_to=task 
| search incident_id="3e864839-xyzab"
| eval is_es_team=if(IN(owner, "Jeff","Rama", "Mel"), 1, 0) 
| eval is_soc_team=if(IN(owner, "Stephen", "Crossman", "Ruby","Cole"), 1,0)
| eval end_time_for_soc=if(is_soc_team==1 AND name=="Escalation to ES", end_time, null()) 
| eval start_time_for_ES=if(is_es_team==1, start_time, null()) 
| eval total_time_claimed=end_time_for_soc - start_time_for_ES&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;in the below snapshot of log the columns name are in sequence of:&amp;nbsp; owner &amp;gt; start_time &amp;gt; end_time &amp;gt; total_time_taken&amp;gt; notes&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vishenps_0-1706723556757.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29176iBC3D8766C950C0DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vishenps_0-1706723556757.png" alt="vishenps_0-1706723556757.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 18:52:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-time-difference/m-p/676145#M231285</guid>
      <dc:creator>vishenps</dc:creator>
      <dc:date>2024-01-31T18:52:38Z</dc:date>
    </item>
  </channel>
</rss>

