<?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 Using the eval command, how do you calculate the time difference between two events WHERE the status value is different? in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379329#M3831</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;There's probably a better function to use for this, but I think it could be done with an eval and where (I think anyway)...&lt;/P&gt;

&lt;P&gt;I need to calculate the time difference between two events WHERE the status value is different. i.e;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event details          status         _time
event 1                       2              2019-03-25 00:01:00
event 2                       3              2019-03-25 00:31:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried this, but it failed;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval time1=_time(where (like status="2")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any ideas?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2019 14:43:02 GMT</pubDate>
    <dc:creator>jacqu3sy</dc:creator>
    <dc:date>2019-03-25T14:43:02Z</dc:date>
    <item>
      <title>Using the eval command, how do you calculate the time difference between two events WHERE the status value is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379329#M3831</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;There's probably a better function to use for this, but I think it could be done with an eval and where (I think anyway)...&lt;/P&gt;

&lt;P&gt;I need to calculate the time difference between two events WHERE the status value is different. i.e;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event details          status         _time
event 1                       2              2019-03-25 00:01:00
event 2                       3              2019-03-25 00:31:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried this, but it failed;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval time1=_time(where (like status="2")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 14:43:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379329#M3831</guid>
      <dc:creator>jacqu3sy</dc:creator>
      <dc:date>2019-03-25T14:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using the eval command, how do you calculate the time difference between two events WHERE the status value is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379330#M3832</link>
      <description>&lt;P&gt;If there is something common between the events like a &lt;CODE&gt;transaction_id&lt;/CODE&gt; you can use the 'transaction' statement, which calculates you a duration in ms.&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.5/SearchReference/Transaction"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.5/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your search| transaction tx_id |eval dur_sec=round((duration/1000) ,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you provide some more relevent data I can expand my example to fit your use case.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 14:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379330#M3832</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-25T14:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using the eval command, how do you calculate the time difference between two events WHERE the status value is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379331#M3833</link>
      <description>&lt;P&gt;I didnt think about 'transaction', I'll take a look at that. Regarding data, I'm using the rule_id of an event taken from the enterprise security macro 'incident_review', which is common between the two events;&lt;/P&gt;

&lt;P&gt;rule_id status  AssignementTime&lt;BR /&gt;
0FF72D78      2      1552985974.388964&lt;BR /&gt;
0FF72D78    3   1552986403.234565&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:51:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379331#M3833</guid>
      <dc:creator>jacqu3sy</dc:creator>
      <dc:date>2020-09-29T23:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using the eval command, how do you calculate the time difference between two events WHERE the status value is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379332#M3834</link>
      <description>&lt;P&gt;Great, just try swapping 'tx_id' for 'rule_id' and see how that fits your needs.&lt;BR /&gt;
Good luck!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Using-the-eval-command-how-do-you-calculate-the-time-difference/m-p/379332#M3834</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-09-29T23:51:58Z</dc:date>
    </item>
  </channel>
</rss>

