<?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 Find time between first and second events grouped - efficiently in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91462#M23536</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am getting events in the form of:&lt;/P&gt;

&lt;P&gt;__time, app_name, action,udid&lt;/P&gt;

&lt;P&gt;"2013-04-11 23:26:32","nxTomo HK V0.9","game_start","1234"&lt;/P&gt;

&lt;P&gt;I wish to group them by udid and find the time in seconds between the first and second event,&lt;BR /&gt;
even if there are more than 2 events in an group.&lt;BR /&gt;
The rest of the events should be ignored.&lt;/P&gt;

&lt;P&gt;Can someone help me do this efficiently?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 13:43:08 GMT</pubDate>
    <dc:creator>noambz</dc:creator>
    <dc:date>2020-09-28T13:43:08Z</dc:date>
    <item>
      <title>Find time between first and second events grouped - efficiently</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91462#M23536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am getting events in the form of:&lt;/P&gt;

&lt;P&gt;__time, app_name, action,udid&lt;/P&gt;

&lt;P&gt;"2013-04-11 23:26:32","nxTomo HK V0.9","game_start","1234"&lt;/P&gt;

&lt;P&gt;I wish to group them by udid and find the time in seconds between the first and second event,&lt;BR /&gt;
even if there are more than 2 events in an group.&lt;BR /&gt;
The rest of the events should be ignored.&lt;/P&gt;

&lt;P&gt;Can someone help me do this efficiently?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:43:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91462#M23536</guid>
      <dc:creator>noambz</dc:creator>
      <dc:date>2020-09-28T13:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find time between first and second events grouped - efficiently</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91463#M23537</link>
      <description>&lt;P&gt;Hi, I think Example 6 here is what you want... &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Eval#Example_6"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Eval#Example_6&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 00:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91463#M23537</guid>
      <dc:creator>jcoates_splunk</dc:creator>
      <dc:date>2013-04-12T00:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Find time between first and second events grouped - efficiently</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91464#M23538</link>
      <description>&lt;P&gt;Not exactly. &lt;/P&gt;

&lt;P&gt;Let's say I have 3 app starts. They will all be grouped together and the duration will measure the time between the 1st and 3rd.&lt;/P&gt;

&lt;P&gt;If I use maxevents=2. Then the other event will be in a separate group which needs to be discarded somehow.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 01:02:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91464#M23538</guid>
      <dc:creator>noambz</dc:creator>
      <dc:date>2013-04-12T01:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Find time between first and second events grouped - efficiently</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91465#M23539</link>
      <description>&lt;P&gt;I tried this and it seems to work.&lt;/P&gt;

&lt;P&gt;action=app_start   | streamstats avg(_time) as prevendtime window=1 current=f global=false by udid | eval timegapsecs=abs(round(_time - prevendtime,0)) | reverse |  dedup 1 udid&lt;/P&gt;

&lt;P&gt;Can anyone comment on the efficiency or correctness of this?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:43:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-time-between-first-and-second-events-grouped-efficiently/m-p/91465#M23539</guid>
      <dc:creator>noambz</dc:creator>
      <dc:date>2020-09-28T13:43:16Z</dc:date>
    </item>
  </channel>
</rss>

