<?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: Stale Active Users in Active Directory in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612453#M212941</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229311"&gt;@andrew_nelson&lt;/a&gt;&amp;nbsp;..unfortunantly though we do not have this Add on installed and due to our environment I'm not able to install this anytime soon.&amp;nbsp; We've recently moved our Splunk instance to a cloud provided and I'm doubtful it will be done before my deadline to provide this data to management.&amp;nbsp; Is there a query, without this addon that will work?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Bob&lt;/P&gt;</description>
    <pubDate>Thu, 08 Sep 2022 17:43:45 GMT</pubDate>
    <dc:creator>Bobmc</dc:creator>
    <dc:date>2022-09-08T17:43:45Z</dc:date>
    <item>
      <title>Can someone help with a sample search to find Stale Active Users in Active Directory?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612432#M212935</link>
      <description>&lt;P&gt;Hello, I'm a bit new to Splunk and I'm trying to run a query that shows me users in Active directory that are still enabled but haven't logged in for past 30 days.&amp;nbsp; I've tried searching through varies post but none seem to be exactly what I'm looking for.&amp;nbsp; I may have overlooked it so If someone can point me in the right direction or provide a sample query to get me started I'd be very grateful.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Bob&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 07:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612432#M212935</guid>
      <dc:creator>Bobmc</dc:creator>
      <dc:date>2022-09-09T07:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Stale Active Users in Active Directory</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612444#M212939</link>
      <description>&lt;P&gt;If you have the Splunk Add-On for Active Directory installed and configured, this should be straight forward enough.&lt;/P&gt;&lt;P&gt;Something like this should work:&lt;BR /&gt;| localop |ldapsearch domain=default search="(&amp;amp;(objectClass=user)(!(objectClass=computer)))" attrs="samaccountname,lastLogonTimestamp,userAccountControl"&lt;BR /&gt;| table sAMAccountName, lastLogonTimestamp, userAccountControl&lt;BR /&gt;| search userAccountControl!="ACCOUNTDISABLE"&lt;BR /&gt;| eval lastLogin=strptime(lastLogonTimestamp, "%Y-%m-%dT%H:%M:%S.%fZ"), threshold=relative_time(now(), "-30d")&lt;BR /&gt;| where lastLogin &amp;lt; threshold&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 16:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612444#M212939</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2022-09-08T16:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Stale Active Users in Active Directory</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612453#M212941</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229311"&gt;@andrew_nelson&lt;/a&gt;&amp;nbsp;..unfortunantly though we do not have this Add on installed and due to our environment I'm not able to install this anytime soon.&amp;nbsp; We've recently moved our Splunk instance to a cloud provided and I'm doubtful it will be done before my deadline to provide this data to management.&amp;nbsp; Is there a query, without this addon that will work?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Bob&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 17:43:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612453#M212941</guid>
      <dc:creator>Bobmc</dc:creator>
      <dc:date>2022-09-08T17:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Stale Active Users in Active Directory</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612460#M212945</link>
      <description>&lt;P&gt;Without a direct connection to AD and without knowing your environment, I can't provide another definitive way to get you the data that you need from Splunk.&lt;/P&gt;&lt;P&gt;You may be able to pull AD with a PowerShell script into a csv and upload to Splunk. A PS forum would be better suited to assisting with that part though.&amp;nbsp;&lt;BR /&gt;I'm not sure the AD export option will format some fields like lastLogon and userAccountControl so there would be a few extra steps.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 18:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612460#M212945</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2022-09-08T18:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Stale Active Users in Active Directory</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612471#M212949</link>
      <description>&lt;P&gt;My AD boxes are reporting to Splunk, however it just the event log data.&amp;nbsp; So I can pull data on Event IDs such as 4624 (successful login) but formatting that so it only shows accounts that haven't done that for a period of time and do not have the Event ID&amp;nbsp;4725 (&lt;SPAN&gt;account was disabled) associated&amp;nbsp;to it is my issue.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; I hope that helps make some sense..&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Bob&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 19:46:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612471#M212949</guid>
      <dc:creator>Bobmc</dc:creator>
      <dc:date>2022-09-08T19:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Stale Active Users in Active Directory</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612513#M212961</link>
      <description>&lt;BLOCKQUOTE&gt;Event IDs such as 4624 (successful login) but formatting that so it only shows accounts that haven't done that for a period of time and do not have the Event ID&amp;nbsp;4725 (&lt;SPAN&gt;account was disabled) associated&amp;nbsp;to it is my issue.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; I hope that helps make some sense..&amp;nbsp;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This makes a lot more sense than asking about AD user behavior because it describes a sequence of events that are already in Splunk, and criteria in terms of data (as opposed to user behavior). &amp;nbsp;It would be even better if&amp;nbsp;you give sample data (anonymized), data structure, sample search you have tried, output from such and why the output does not meet your requirements. &amp;nbsp;After all, this is a Splunk forum, not AD forum.&lt;/P&gt;&lt;P&gt;As someone who has never seen Windows eventlog in Splunk, I wonder how would you determine that a user even exists if he or she hasn't had activity for a long time? (Assuming your search period is finite.)&lt;/P&gt;&lt;P&gt;With this question in mind, the following uses earliest=0 (all time) to signify that it should contain long enough period of time in order to identify users who haven't had activity for a very long time - all without a second source for list of users.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source=EventLog EventID IN (4624, 4625) earliest=0
| stats max(_time) as lasttime by AccountID EventID
| stats values(EventID) max(lasttime) as _time by AccountID
| where 'values(EventID)' != 4625 AND _time &amp;lt; relative_time(now(), "-30d")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Again, I have no idea what identifies your Windows source, what are field names, and so on so the entire thing is made up.) &amp;nbsp;Assuming event sequence like the following&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;AccountID&lt;/TD&gt;&lt;TD&gt;EventID&lt;/TD&gt;&lt;TD&gt;_time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;joe&lt;/TD&gt;&lt;TD&gt;4624&lt;/TD&gt;&lt;TD&gt;2022-05-01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jane&lt;/TD&gt;&lt;TD&gt;4624&lt;/TD&gt;&lt;TD&gt;2022-05-20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;joe&lt;/TD&gt;&lt;TD&gt;4625&lt;/TD&gt;&lt;TD&gt;2022-06-01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jane&lt;/TD&gt;&lt;TD&gt;4624&lt;/TD&gt;&lt;TD&gt;2022-07-01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jason&lt;/TD&gt;&lt;TD&gt;4624&lt;/TD&gt;&lt;TD&gt;2022-08-20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;suze&lt;/TD&gt;&lt;TD&gt;4624&lt;/TD&gt;&lt;TD&gt;2022-09-01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;the above search should give&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;AccountID&lt;/TD&gt;&lt;TD&gt;values(EventID)&lt;/TD&gt;&lt;TD&gt;_time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;jane&lt;/TD&gt;&lt;TD&gt;4624&lt;/TD&gt;&lt;TD&gt;2022-07-01 00:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course search earliest=0 is very expensive. &amp;nbsp;So, if there's some periodic machine generated event for inactive accounts, the task would be easier.&lt;/P&gt;&lt;P&gt;A possible reduction of cost (if you have to search earliest=0) is with tstats, e.g.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats max(_time) as lasttime where EventID IN (4624, 4625) earliest=0 by AccountID EventID
| stats values(EventID) max(lasttime) as _time by AccountID
| where 'values(EventID)' != 4625 AND _time &amp;lt; relative_time(now(), "-30d")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 06:37:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612513#M212961</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-09T06:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Stale Active Users in Active Directory</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612548#M212974</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;As someone who has never seen Windows eventlog in Splunk, I wonder how would you determine that a user even exists if he or she hasn't had activity for a long time? (Assuming your search period is finite.)&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yeah this is exactly the reason I was going down the Add-On for AD and script routes to get the full list of AD users.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Through the WinEventLog, Splunk can tell you what happened and when, but it can't tell you an account exists if it doesn't have any events related to that account.&lt;/P&gt;&lt;P&gt;A full inventory of user accounts is needed to determine what accounts aren't being used.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 10:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-with-a-sample-search-to-find-Stale-Active-Users/m-p/612548#M212974</guid>
      <dc:creator>andrew_nelson</dc:creator>
      <dc:date>2022-09-09T10:41:21Z</dc:date>
    </item>
  </channel>
</rss>

