<?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 Timechart span=1d count by new users not seen before in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686931#M234289</link>
    <description>&lt;P&gt;Here is my example search to start...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=data
| timechart span=1d by user&lt;/LI-CODE&gt;
&lt;P&gt;Now, I am trying to build out so the last 30 days I can get a count of new users that has not been seen on previous days.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried some bin options and something like this but no joy.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=data | stats min(_time) as firstTime by user | eval isNew=if(strftime(firstTime, "%Y-%m-%d") == strftime(_time, "%Y-%m-%d"), 1, 0) | where isNew=1&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Any help?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 23:41:47 GMT</pubDate>
    <dc:creator>jenkinsta</dc:creator>
    <dc:date>2024-05-08T23:41:47Z</dc:date>
    <item>
      <title>Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686931#M234289</link>
      <description>&lt;P&gt;Here is my example search to start...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=data
| timechart span=1d by user&lt;/LI-CODE&gt;
&lt;P&gt;Now, I am trying to build out so the last 30 days I can get a count of new users that has not been seen on previous days.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried some bin options and something like this but no joy.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=data | stats min(_time) as firstTime by user | eval isNew=if(strftime(firstTime, "%Y-%m-%d") == strftime(_time, "%Y-%m-%d"), 1, 0) | where isNew=1&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Any help?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 23:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686931#M234289</guid>
      <dc:creator>jenkinsta</dc:creator>
      <dc:date>2024-05-08T23:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686935#M234291</link>
      <description>&lt;P&gt;This can tell you if the user's first login is the same as his last - hopefully this will give you some pointers&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=data earliest=-30d
| bin _time span=1d 
| stats count by _time user
| eventstats min(_time) as first max(_time) as last by user
| where first = last&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 00:00:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686935#M234291</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-05-09T00:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686951#M234295</link>
      <description>&lt;P&gt;You need historic data of users to compare.&lt;BR /&gt;You would need to configure Assets&amp;amp;Identities or save users to simple lookup.&lt;BR /&gt;You can store results daily, weekly, monthly using this search:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;index=your_users_index &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;``` Add or configure neccessary fields &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval bunit="your_bunit", startDate=strftime(now(),"%Y-%m-%d %H:%M:%S"), &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| stats count by email, identity, nick, UserId, "first", "last", JobTitle, phone, bunit, work_country, work_city, startDate &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table email, identity, nick, UserId, "first", "last", JobTitle, phone, bunit, work_country, work_city, startDate &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| search NOT [| inputlookup users.csv | fields email ] &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| outputlookup append=true users.csv&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;And later you can sort users startDate using this search:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;| inputlookup users.csv&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| sort - startDate&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Or get last month's new users:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;| inputlookup users.csv&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval epoch=strptime(startDate, "%Y-%m-%d %H:%M:%S")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| where epoch&amp;gt;relative_time(now(), "-20d")&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 04:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686951#M234295</guid>
      <dc:creator>Temuulen0303</dc:creator>
      <dc:date>2024-05-09T04:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686953#M234297</link>
      <description>&lt;P&gt;Is this a ChatGPT answer - firstly the OP does not mention having the Splunk Enterprise Security app - A&amp;amp;I framework is part of ES and your example search seems to be related to a query that would populate an Identity registry in ES rather than anything to do with the OP's post.&lt;/P&gt;&lt;P&gt;Secondly, the technique of &lt;STRONG&gt;search NOT [| inputlookup...]&lt;/STRONG&gt;&amp;nbsp;technique should never be recommended without a big warning on the use of subsearches which can perform terribly - I recently fixed a search using a NOT subsearch that was taking 18 minutes to evaluate the NOT criteria and reduced it to 9 seconds.&lt;/P&gt;&lt;P&gt;Certainly, a lookup of users to validate against can be a valid solution, but this would depend on whether the OP wants to find a new user's first ever login vs checking if the user has not logged in for 30 days, which is not clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 04:26:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686953#M234297</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-05-09T04:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686965#M234301</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/187993"&gt;@jenkinsta&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=data earliest=-30d latest=now
| eval period=if(_time&amp;gt;now()-86400,"last","previous")
| stats dc(period) AS period_count values(period) AS period BY user 
| where period_count=1 AND period="last"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 06:14:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686965#M234301</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-09T06:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686978#M234303</link>
      <description>&lt;P&gt;The question is a bit imprecise.&lt;/P&gt;&lt;P&gt;What do you want to do precisely?&lt;/P&gt;&lt;P&gt;I'd interpret it as "For each day I want to get a count of accounts not appearing in the events already in any of the previous days". Is that right? Also how do you treat the first day of such summary? Because all acccounts from the first day would get shown this way first day.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 07:47:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/686978#M234303</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-05-09T07:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/687027#M234317</link>
      <description>&lt;P&gt;I'm looking for login attempts and the question is to identify new attempts from usernames that previously didn't try.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Day 1&amp;nbsp; = day count of new seen 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;bob&lt;/P&gt;&lt;P&gt;sam&lt;/P&gt;&lt;P&gt;steve&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Day 2&amp;nbsp; &amp;nbsp; &amp;nbsp; = day count of new seen 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;sam&amp;nbsp; # because previously seen, exclude from count&lt;/P&gt;&lt;P&gt;tom&lt;/P&gt;&lt;P&gt;ralph&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 11:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/687027#M234317</guid>
      <dc:creator>jenkinsta</dc:creator>
      <dc:date>2024-05-09T11:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart span=1d count by new users not seen before</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/687093#M234348</link>
      <description>&lt;P&gt;Ok. So I'd approach this from a different way.&lt;/P&gt;&lt;P&gt;Let's do some initial search&lt;/P&gt;&lt;PRE&gt;index=data&lt;/PRE&gt;&lt;P&gt;Then for each user we find his first ever occurrence&lt;/P&gt;&lt;PRE&gt;| stats min(_time) as _time by user&lt;/PRE&gt;&lt;P&gt;After this we have a list of first logins spread across time. So now all we need is to count those logins across each day&lt;/P&gt;&lt;PRE&gt;| timechart span=1d count&lt;/PRE&gt;&lt;P&gt;And that's it.&lt;/P&gt;&lt;P&gt;If you also wanted to have a list of those users for each day instead of doing the timechart you should rather group the users by day manually&lt;/P&gt;&lt;PRE&gt;| bin _time span=1d&lt;/PRE&gt;&lt;P&gt;So now you can aggregate the values over time&lt;/P&gt;&lt;PRE&gt;| stats count as 'Overall number of logins' values(user) as Users&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 20:47:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-span-1d-count-by-new-users-not-seen-before/m-p/687093#M234348</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-05-09T20:47:13Z</dc:date>
    </item>
  </channel>
</rss>

