<?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: Finding time between two events. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245362#M73142</link>
    <description>&lt;P&gt;Thanks.  This was very close to what I need.  Problem is where user has logged inn more than once with same username. &lt;STRONG&gt;avg(duration)&lt;/STRONG&gt; gives the time between the first and last event.  I need the time between first event and second event.  Or to be more specific, time between last received SMS and first login after it.  A user may request as many SMS he likes, so he can request two SMS and then login using information on last SMS.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2016 11:42:41 GMT</pubDate>
    <dc:creator>lakromani</dc:creator>
    <dc:date>2016-01-22T11:42:41Z</dc:date>
    <item>
      <title>Finding time between two events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245360#M73140</link>
      <description>&lt;P&gt;Using transaction I have grouped together events for same users.&lt;BR /&gt;
There are two types of event.&lt;BR /&gt;
 1. Send SMS to user.&lt;BR /&gt;
 2. Log in with this user.&lt;/P&gt;

&lt;P&gt;It looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Jan 22 11:52:15 172.30.112.1 PORTAL: SMS sent to 91813504.
Jan 22 11:54:11 172.30.112.1 AAA: 172.30.44.246 logged in with username 91813504

Jan 22 11:52:04 172.30.112.1 PORTAL: SMS sent to 91300083.
Jan 22 11:53:36 172.30.112.1 AAA: 172.30.53.83 logged in with username 91300083

Jan 22 11:51:10 172.30.112.1 PORTAL: SMS sent to 41237212.
Jan 22 11:51:50 172.30.112.1 AAA: 172.30.40.116 logged in with username 41237212
Jan 22 12:01:37 172.30.112.1 AAA: 172.30.40.113 logged in with username 41237212
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Some user logs inn several times.&lt;/P&gt;

&lt;P&gt;I do like to calculate the time from sent SMS to the first log in.&lt;BR /&gt;
Result I need is some like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;91813504 00:01:56
91300083 00:01:32
41237212 00:00:40
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then I can graph the duration over time and see if there are some wrong with the SMS sent to the user.&lt;BR /&gt;
How to do this?&lt;BR /&gt;&lt;BR /&gt;
Maybe I do not need it use Transaction, but it gives me a visual view of events that belongs to same user.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 11:16:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245360#M73140</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-01-22T11:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Finding time between two events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245361#M73141</link>
      <description>&lt;P&gt;You are correct about using &lt;CODE&gt;transaction&lt;/CODE&gt;.. Add this at the end of your search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart avg(duration)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Duration is a Splunk keyword which will find the difference between the timestamps &lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 11:23:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245361#M73141</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2016-01-22T11:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Finding time between two events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245362#M73142</link>
      <description>&lt;P&gt;Thanks.  This was very close to what I need.  Problem is where user has logged inn more than once with same username. &lt;STRONG&gt;avg(duration)&lt;/STRONG&gt; gives the time between the first and last event.  I need the time between first event and second event.  Or to be more specific, time between last received SMS and first login after it.  A user may request as many SMS he likes, so he can request two SMS and then login using information on last SMS.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 11:42:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245362#M73142</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-01-22T11:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Finding time between two events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245363#M73143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I would recommend you to use "transaction" command to calculate duration.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;transaction startswith="PORTAL: SMS sent to"   endswith="logged in with username" |concurrency duration=duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can classify the duration by phone numbers and IP address if you need.&lt;/P&gt;

&lt;P&gt;Hope it is ok.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Gokhan&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 11:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245363#M73143</guid>
      <dc:creator>gyarici</dc:creator>
      <dc:date>2016-01-22T11:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Finding time between two events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245364#M73144</link>
      <description>&lt;P&gt;Since majority av the users only have one SMS and one login, and the &lt;STRONG&gt;transaction&lt;/STRONG&gt; need to contain both, I just use &lt;STRONG&gt;eventcount=2&lt;/STRONG&gt;  in search after the transaction.  This way I ignore all other and get a correct view.  Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 11:49:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245364#M73144</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-01-22T11:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding time between two events.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245365#M73145</link>
      <description>&lt;P&gt;This does not work since one user may log inn between another user sends SMS and logs inn. &lt;STRONG&gt;transaction startswith="PORTAL: SMS sent to"   endswith="logged in with username"&lt;/STRONG&gt;  This mixes user together.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 19:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-time-between-two-events/m-p/245365#M73145</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2016-01-25T19:19:15Z</dc:date>
    </item>
  </channel>
</rss>

