<?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: Timechart: Returning Users in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118233#M31560</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;thanks for your answer.&lt;/P&gt;

&lt;P&gt;When I run your search, there a are only a very few "activeBothDays" with a count of one. I think this is caused, because it is only counted, when the difference of two subsequent events is exactly 86400 sec. I it does not count, if somebody played 01.01.2013 23:00:00 and 02.02.2013 14:00:00. In this case this player should be counted as returned for day 02.02.2013.&lt;/P&gt;

&lt;P&gt;do you have an idea how to adjust the search?&lt;/P&gt;

&lt;P&gt;Best&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2013 09:57:14 GMT</pubDate>
    <dc:creator>HeinzWaescher</dc:creator>
    <dc:date>2013-10-29T09:57:14Z</dc:date>
    <item>
      <title>Timechart: Returning Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118231#M31558</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I want to achieve a timechart with a stat for returning Users, which means the number of unique users who have been active on day n &lt;STRONG&gt;and&lt;/STRONG&gt; on day n-1 This should look like this in the end:&lt;/P&gt;

&lt;P&gt;07.01.2013  1500&lt;/P&gt;

&lt;P&gt;08.01.2013  2000&lt;/P&gt;

&lt;P&gt;09.01.2013  2500&lt;/P&gt;

&lt;P&gt;...and so on.&lt;/P&gt;

&lt;P&gt;The first number is the count of unique users, that have been active on 07.01.2013 &lt;STRONG&gt;and&lt;/STRONG&gt; 06.01.2013.&lt;/P&gt;

&lt;P&gt;The second number is the count of unique users, that have been active on 08.01.2013 &lt;STRONG&gt;and&lt;/STRONG&gt; 07.01.2013.&lt;/P&gt;

&lt;P&gt;The third number is the count of unique users, that have been active on 09.01.2013 &lt;STRONG&gt;and&lt;/STRONG&gt; 08.01.2013.&lt;/P&gt;

&lt;P&gt;and so on...&lt;/P&gt;

&lt;P&gt;A hint how to achieve this would be great.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2013 16:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118231#M31558</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-10-28T16:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart: Returning Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118232#M31559</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| bucket _time span=1d
| stats count by user _time
| sort _time
| delta _time AS timeDelta p=1
| streamstats last(user) as lastUser current=f
| eval activeBothDays = if( timeDelta==86400 AND user==lastUser,1,0)
| timechart span=1d sum(activeBothDays) as UserCount 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First it generates a list of users that were active for each day. Then it computes the difference in time between subsequent events - and collects the name of the user from the prior event. If the user names match and the events are exactly 1 day apart, then &lt;CODE&gt;activeBothDays&lt;/CODE&gt; is set to 1. The sum of the &lt;CODE&gt;activeBothDays&lt;/CODE&gt; field is the number of users who were active on both the current day and the prior day.&lt;/P&gt;

&lt;P&gt;I would test this by running&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| bucket _time span=1d
| stats count by user _time
| sort _time
| delta _time AS timeDelta p=1
| streamstats last(user) as lastUser current=f
| eval activeBothDays = if( timeDelta==86400 AND user==lastUser,1,0)
| table _time user lastUser timeDelta activeBothDays
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Oct 2013 22:07:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118232#M31559</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-10-28T22:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart: Returning Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118233#M31560</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;thanks for your answer.&lt;/P&gt;

&lt;P&gt;When I run your search, there a are only a very few "activeBothDays" with a count of one. I think this is caused, because it is only counted, when the difference of two subsequent events is exactly 86400 sec. I it does not count, if somebody played 01.01.2013 23:00:00 and 02.02.2013 14:00:00. In this case this player should be counted as returned for day 02.02.2013.&lt;/P&gt;

&lt;P&gt;do you have an idea how to adjust the search?&lt;/P&gt;

&lt;P&gt;Best&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 09:57:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118233#M31560</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-10-29T09:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart: Returning Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118234#M31561</link>
      <description>&lt;P&gt;Hi Heinz - that is what the &lt;CODE&gt;bucket _time span=1d&lt;/CODE&gt; should do - set all the times to 00:00 of that day. So the differences really should be exactly 86400 seconds. Perhaps the calculation I used is faulty. I have edited the answer above, so can you try it again?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 18:32:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118234#M31561</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-10-29T18:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart: Returning Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118235#M31562</link>
      <description>&lt;P&gt;Hello lguinn,&lt;/P&gt;

&lt;P&gt;unfortunately it still doesn't seem to work properly. Only a few rows in the timechart have a count, which is always 1.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2013 09:10:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118235#M31562</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-10-30T09:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart: Returning Users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118236#M31563</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;another idea came to my mind:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;set the time to 00:00 per each day&lt;/LI&gt;
&lt;LI&gt;dedup user,_time (I would expect that every user will have only one event per day of activity?!)&lt;/LI&gt;
&lt;LI&gt;delta _time per user (I would expect, that this calculates the difference of _time: event time of User A - previous event time of User A&lt;/LI&gt;
&lt;LI&gt;after that a filter could be set to keep only events where the new calculated field = 86400&lt;/LI&gt;
&lt;LI&gt;timechart dc(user) span=1d&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Do you think that is possible to get the needed results? Espacially I'm not sure how to realize the step "delta _time per user".&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2013 09:52:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-Returning-Users/m-p/118236#M31563</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-10-30T09:52:40Z</dc:date>
    </item>
  </channel>
</rss>

