<?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: Duration between events - Max gap (not the start and end points) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500520#M139348</link>
    <description>&lt;P&gt;no... can't be this straight forward&lt;/P&gt;

&lt;P&gt;| streamstats current=t window=2 range(_time) AS duration BY customerNumber &lt;BR /&gt;
 | stats min(duration) AS Min max(duration) AS Max avg(duration) AS Avg BY customerNumber &lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 10:31:52 GMT</pubDate>
    <dc:creator>stephenreece</dc:creator>
    <dc:date>2020-02-04T10:31:52Z</dc:date>
    <item>
      <title>Duration between events - Max gap (not the start and end points)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500519#M139347</link>
      <description>&lt;P&gt;hi all .&lt;/P&gt;

&lt;P&gt;I am trying to create a map where I can look at users max duration between logins who register with us between 2 fixed dates i.e. jan17-feb17.&lt;/P&gt;

&lt;P&gt;So i have the following which is interesting but doesnt give the max length.&lt;/P&gt;

&lt;P&gt;| dedup eventId &lt;BR /&gt;
| stats count(_time) as appear_count, values(_time) as appear_dates max(_time) as last min(_time) as latest by customerNumber&lt;BR /&gt;
| eval first_appear=strftime(first,"%d/%m/%Y") &lt;BR /&gt;
| eval last_appear=strftime(last,"%d/%m/%Y") &lt;BR /&gt;
| eval appear_dates=strftime(appear_dates,"%d/%m/%Y") &lt;BR /&gt;
| eval duration=(last-latest)&lt;BR /&gt;
| eval duration=round((last-first)/86400)&lt;BR /&gt;
| where first&amp;lt;01/02/2019&lt;/P&gt;

&lt;P&gt;For example i have a user that has used the service 400 times with a max break of about a week.  So i needed the search to pick up the user where first appear = jan-feb2017 and then i need to know that this user has had at max a weeks break between accessing.&lt;/P&gt;

&lt;P&gt;Does this make sense.  &lt;/P&gt;

&lt;P&gt;Its almost as if i need towrite the search to collect all users where first&amp;lt;28/02/2017.&lt;BR /&gt;&lt;BR /&gt;
 - and then i need to eval each event in order and subtract the later from the earlier,.. so for someone who accessed the service 5 times it would be&lt;/P&gt;

&lt;P&gt;USER ONE &lt;BR /&gt;
first=22/02/2017&lt;BR /&gt;
event 1 22/02/2017&lt;BR /&gt;
event 2 25/02/2017  (diff between event 2-1 = 3days)&lt;BR /&gt;
event 3 01/03/2017  (diff between event 3-2 = 4days)&lt;BR /&gt;
&lt;STRONG&gt;event 4 09/03/2017  (diff between event 2-1 = 8days)&lt;/STRONG&gt; &lt;BR /&gt;
LAST event 5 10/03/2017  (diff between event 2-1 = 1day)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Therefore max duration between events = 8days&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:59:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500519#M139347</guid>
      <dc:creator>stephenreece</dc:creator>
      <dc:date>2020-09-30T03:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Duration between events - Max gap (not the start and end points)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500520#M139348</link>
      <description>&lt;P&gt;no... can't be this straight forward&lt;/P&gt;

&lt;P&gt;| streamstats current=t window=2 range(_time) AS duration BY customerNumber &lt;BR /&gt;
 | stats min(duration) AS Min max(duration) AS Max avg(duration) AS Avg BY customerNumber &lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 10:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500520#M139348</guid>
      <dc:creator>stephenreece</dc:creator>
      <dc:date>2020-02-04T10:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Duration between events - Max gap (not the start and end points)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500521#M139349</link>
      <description>&lt;P&gt;That is about the answer I was going to suggest and should give you correct results.&lt;/P&gt;

&lt;P&gt;If your testing shows it is (which is should be), why not write that up as your own answer, then mark it as accepted?  It's perfectly acceptable to [at least occasionally] answer your own questions!&lt;/P&gt;

&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 15:54:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500521#M139349</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-02-04T15:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Duration between events - Max gap (not the start and end points)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500522#M139350</link>
      <description>&lt;P&gt;Yep.  Write it up and accept it.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 19:58:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duration-between-events-Max-gap-not-the-start-and-end-points/m-p/500522#M139350</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-02-04T19:58:41Z</dc:date>
    </item>
  </channel>
</rss>

