<?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 get time duration between two events INSIDE a transaction? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247057#M73677</link>
    <description>&lt;P&gt;The mvindex is returning string, so need to convert to number. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval actionDuration=tonumber(mvindex(split(end,"#"),1))-tonumber(mvindex(split(start,"#"),1))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 01 Oct 2015 17:38:12 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-10-01T17:38:12Z</dc:date>
    <item>
      <title>How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247047#M73667</link>
      <description>&lt;P&gt;Basically what the log looks like is as below:&lt;/P&gt;

&lt;P&gt;User log in---&lt;BR /&gt;
some trivial events---&lt;BR /&gt;
&lt;STRONG&gt;User start a action ----&lt;/STRONG&gt;&lt;BR /&gt;
some trivial events---&lt;BR /&gt;
&lt;STRONG&gt;User end a action ----&lt;/STRONG&gt;&lt;BR /&gt;
some trivial events---&lt;BR /&gt;
User log out---&lt;/P&gt;

&lt;P&gt;I managed to use transaction to extract the events between user log in and user log out, but what I need is to get the start time and end time of this action and the time duration between start and end.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated...&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 08:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247047#M73667</guid>
      <dc:creator>InkerzBrad</dc:creator>
      <dc:date>2015-09-30T08:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247048#M73668</link>
      <description>&lt;P&gt;Can you provide some sample logs and current query?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 18:31:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247048#M73668</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-30T18:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247049#M73669</link>
      <description>&lt;P&gt;Yeah sure:&lt;BR /&gt;
the log is like:&lt;/P&gt;

&lt;P&gt;SessionID ConnectionID (both are fields extracted) ..user_auth..(plaint text inside log)&lt;BR /&gt;
SessionID ConnectionID (both are fields extracted) ..user_action_start..(plaint text inside log)&lt;BR /&gt;
SessionID ConnectionID (both are fields extracted) ..user_action_end..(plaint text inside log)&lt;BR /&gt;
SessionID ConnectionID (both are fields extracted) ..user_signoff..(plaint text inside log)&lt;/P&gt;

&lt;P&gt;and my current query is &lt;BR /&gt;
*| transaction Session connectionID startswith="user_auth" endswith="user_signoff" &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:27:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247049#M73669</guid>
      <dc:creator>InkerzBrad</dc:creator>
      <dc:date>2020-09-29T07:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247050#M73670</link>
      <description>&lt;P&gt;The &lt;CODE&gt;transaction&lt;/CODE&gt; command creates a field called &lt;CODE&gt;duration&lt;/CODE&gt; whose value is the difference between the timestamps for the first and last events in the transaction.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 00:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247050#M73670</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-01T00:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247051#M73671</link>
      <description>&lt;P&gt;Thanks, but I need the timestamps difference between two events  that inside the transaction, not the first or the last. Any way I could do that?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 00:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247051#M73671</guid>
      <dc:creator>InkerzBrad</dc:creator>
      <dc:date>2015-10-01T00:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247052#M73672</link>
      <description>&lt;P&gt;Why not adjust the transaction to start and end with the events that you need for it to?  Then you can use &lt;CODE&gt;duration&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 00:55:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247052#M73672</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-01T00:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247053#M73673</link>
      <description>&lt;P&gt;because I need to make sure it happens inside the user's login session so that I can know some much time one user spent on this action.&lt;/P&gt;

&lt;P&gt;Or maybe there's another way?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 01:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247053#M73673</guid>
      <dc:creator>InkerzBrad</dc:creator>
      <dc:date>2015-10-01T01:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247054#M73674</link>
      <description>&lt;P&gt;Well give this a try. Assuming you can extract the action performed by the events into a field (e.g. user_auth, user_action_start, user_action_end, user_signoff&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | rex "\suser_(?&amp;lt;Action&amp;gt;\w+)" | eval temp=mvzip(Action,"_time","#") | transaction Session connectionID startswith="user_auth" endswith="user_signoff"  | eval start=mvfilter(match(temp,"action_start")) | eval end=mvfilter(match(temp,"action_end")) | eval actionDuration=mvindex(split(end,"#"),1)-mvindex(split(start,"#"),1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247054#M73674</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T07:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247055#M73675</link>
      <description>&lt;P&gt;Thanks, in the last statement which is actionDuration=mvindex(split(end,"#"),1)-mvindex(split(start,"#"),1), it says '-' only takes number, which _time is apparently not. How could I solve it?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 04:14:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247055#M73675</guid>
      <dc:creator>InkerzBrad</dc:creator>
      <dc:date>2015-10-01T04:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247056#M73676</link>
      <description>&lt;P&gt;It does the job!!&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 05:10:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247056#M73676</guid>
      <dc:creator>InkerzBrad</dc:creator>
      <dc:date>2015-10-01T05:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get time duration between two events INSIDE a transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247057#M73677</link>
      <description>&lt;P&gt;The mvindex is returning string, so need to convert to number. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval actionDuration=tonumber(mvindex(split(end,"#"),1))-tonumber(mvindex(split(start,"#"),1))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Oct 2015 17:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-time-duration-between-two-events-INSIDE-a-transaction/m-p/247057#M73677</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-01T17:38:12Z</dc:date>
    </item>
  </channel>
</rss>

