<?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: Keep Last Daily Activity Per User in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124003#M25579</link>
    <description>&lt;P&gt;Hi Martin,&lt;/P&gt;

&lt;P&gt;im Grunde tut die Suche was ich möchte. Ich habe ein paar Stichproben für einzelne User gemacht. Allerdings scheint mein Ansatz "das letzte Event des Tages pro User" zu behalten" nicht optimal zu sein. Wenn ich &lt;/P&gt;

&lt;P&gt;"| bucket _time span=1d| dedup user,_time"&lt;/P&gt;

&lt;P&gt;aus meiner Suche entferne, dürfte sich ja eigentlich nichts an der Anzahl der Unique_Users pro Tag ändern. Aber es kommt zu vereinzelnten (sehr geringen) Veränderungen.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:10:37 GMT</pubDate>
    <dc:creator>HeinzWaescher</dc:creator>
    <dc:date>2020-09-28T15:10:37Z</dc:date>
    <item>
      <title>Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/123997#M25573</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;i would like to keep the last event/activity of a day for every user (so filter out all other events).&lt;/P&gt;

&lt;P&gt;I used this command:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;bucket _time span=1d | dedup user, _time | timechart span=1d dc(user)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;This is just an testexample I tried out. The same result should appear, when I only use &lt;STRONG&gt;|  timechart span=1d dc(user)&lt;/STRONG&gt;. But there a very small differences.&lt;/P&gt;

&lt;P&gt;Is there a better function that can be used here?&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 14:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/123997#M25573</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-10-31T14:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/123998#M25574</link>
      <description>&lt;P&gt;I'm not sure why you're trying to answer "last daily activity" with a distinct count... here's a thought:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=-h@h latest=@h | timechart span=15m first(_raw) by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This looks at an hour of _internal data and gives you the last activity per sourcetype. I'm sure you can adapt this for your specific needs.&lt;/P&gt;

&lt;P&gt;PS: If you need German-language help (judging by your name) we can certainly work something out.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 18:17:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/123998#M25574</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-10-31T18:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/123999#M25575</link>
      <description>&lt;P&gt;You can try the following&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;"base search"| stats last(*) as * by user,date_mday&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;This should give you all the fields from the last event for each user for each day.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 18:25:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/123999#M25575</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-10-31T18:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124000#M25576</link>
      <description>&lt;P&gt;While the answers below seem ok, you already have something similar; perhaps you could expand this with more fields;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | bucket _time span=1d | dedup user, _time, sourcetype, host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you want have events on a per sourcetype/host basis.&lt;/P&gt;

&lt;P&gt;..and &lt;CODE&gt;dc(user)&lt;/CODE&gt; will not produce anything near what the title of the question says.&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 19:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124000#M25576</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-31T19:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124001#M25577</link>
      <description>&lt;P&gt;Hi everybody and thanks for your answers.&lt;/P&gt;

&lt;P&gt;Unfortunately, I dont think it's possible to adjust your ideas to my search.&lt;BR /&gt;
To avoid misunderstandings, i will post my whole search and try to explain the goals.&lt;/P&gt;

&lt;P&gt;What i want to achieve is a timechart, which shows the daily active (unique) users and the average age of these users on that day. The age (in days) of user A should be defined in every event as the timespan between his current eventtimestamp and his first activity in the dataset. The first activity (in seconds) of each user is defined in a lookuptable "first_activity.csv".&lt;/P&gt;

&lt;P&gt;To achieve, that every user is only taken into account once per day to calculate the average age ,i just want to use the age of each users last daily event.&lt;/P&gt;

&lt;P&gt;So what I've done is this:&lt;/P&gt;

&lt;P&gt;sourcetype=...  | lookup first_activity.csv user OUTPUT firstactivity |  eval event_time= eventtime/1000   | eval age=floor((event_time-first_activity)/3600/24)+1 | &lt;STRONG&gt;bucket _time span=1d| dedup user,_time&lt;/STRONG&gt;| timechart span=1d dc(user) AS Uniqe_Users,avg(age) AS Avg_Age | eval Avg_Age=round(Avg_Age,0)&lt;/P&gt;

&lt;P&gt;Best&lt;BR /&gt;
Heinz&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124001#M25577</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2020-09-28T15:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124002#M25578</link>
      <description>&lt;P&gt;So... does your search now solve your problem? I'm not quite sure if I understand you correctly in that regard &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;My offer for German-language help still stands if necessary, even beyond this single question.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2013 13:38:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124002#M25578</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-11-01T13:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124003#M25579</link>
      <description>&lt;P&gt;Hi Martin,&lt;/P&gt;

&lt;P&gt;im Grunde tut die Suche was ich möchte. Ich habe ein paar Stichproben für einzelne User gemacht. Allerdings scheint mein Ansatz "das letzte Event des Tages pro User" zu behalten" nicht optimal zu sein. Wenn ich &lt;/P&gt;

&lt;P&gt;"| bucket _time span=1d| dedup user,_time"&lt;/P&gt;

&lt;P&gt;aus meiner Suche entferne, dürfte sich ja eigentlich nichts an der Anzahl der Unique_Users pro Tag ändern. Aber es kommt zu vereinzelnten (sehr geringen) Veränderungen.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:10:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124003#M25579</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2020-09-28T15:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124004#M25580</link>
      <description>&lt;P&gt;Moin Heinz,&lt;/P&gt;

&lt;P&gt;die Kombination von &lt;CODE&gt;bucket&lt;/CODE&gt; und &lt;CODE&gt;dedup&lt;/CODE&gt; gibt keine Garantien darüber, &lt;EM&gt;welches&lt;/EM&gt; Event behalten wird. Schließlich klopft das &lt;CODE&gt;bucket&lt;/CODE&gt; alle Zeitstempel flach, bevor aussortiert wird.&lt;/P&gt;

&lt;P&gt;Am &lt;CODE&gt;dc(user)&lt;/CODE&gt; sollte das in der Tat nichts ändern. Bei &lt;CODE&gt;avg(age)&lt;/CODE&gt; habe ich aber Bedenken - ist pro User und Tag vor &lt;CODE&gt;bucket&lt;/CODE&gt; das &lt;CODE&gt;age&lt;/CODE&gt; identisch? Falls in der Lookup-Tabelle "krumme" Daten stehen, kann es untertägig den Sprung von einem Tag auf den nächsten geben.&lt;/P&gt;

&lt;P&gt;Viele Grüße aus Kiel,&lt;BR /&gt;
Martin&lt;/P&gt;

&lt;P&gt;For the English speakers: In principle the issue is solved with HeinzWaescher's query.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2013 13:54:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124004#M25580</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-11-01T13:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Keep Last Daily Activity Per User</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124005#M25581</link>
      <description>&lt;P&gt;Ich habe gedacht die Zeitstempel werden flachgeklopft, aber die Reihenfolge der Events bleibt bestehen. Entsprechend würde durch "dedup" dann das letzte gewählt. (Falls nicht, wäre das jetzt auch nicht sooo dramatisch. Hauptsache es bleibt erstmal ein einziges pro Tag übrig)&lt;/P&gt;

&lt;P&gt;In der Lookuptabelle steht der timestamp der "first activity" in sekunden. Das kann ja aber keinen Einfluss auf die Unique_Users haben.&lt;/P&gt;

&lt;P&gt;Das avg_age wird sich durch "dedup" ändern, da pro User nur noch ein age verwendet wird.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2013 14:04:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Keep-Last-Daily-Activity-Per-User/m-p/124005#M25581</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-11-01T14:04:55Z</dc:date>
    </item>
  </channel>
</rss>

