<?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: How do I edit my search to identify inactive users over the last 12 months? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285259#M86287</link>
    <description>&lt;P&gt;Try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local 
| fields realname, title
| rename title as user
| join user type=left [
   | search index=_audit action="login attempt" earliest=-12mon
   | stats max(timestamp) as _time by user, sourcetype
]
| where isnull(sourcetype)
| fields - sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Feb 2016 09:08:14 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-02-10T09:08:14Z</dc:date>
    <item>
      <title>How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285256#M86284</link>
      <description>&lt;P&gt;Hi, I wonder whether someone could help me please.&lt;/P&gt;

&lt;P&gt;I'm trying to create a search which identifies inactive users over the last 12 months (time period selected by 'time picker').&lt;/P&gt;

&lt;P&gt;I found the following search which returns a list of current user accounts which works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/authentication/users splunk_server=local 
|fields realname
|rename realname as user
|table user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I then found a search as shown below which displays the last time a user logged on, which again works.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action="login attempt"
|stats max(timestamp) by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I've tried to amalgamate these so that only the users which appear in the first search, but not in the second will be reported and I came up with the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/authentication/users splunk_server=local 
|fields realname
|rename realname as user
|eval user1="Y"
|table user user1
|join type=outer user[search index=_audit action="login attempt"
|stats max(timestamp) by user
|eval user2="Y"
|where user1 = "Y" AND user2 != "Y"
|table user]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem I have is that the list returned shows all the users irrespective of whether they have logged on in the last year.&lt;/P&gt;

&lt;P&gt;I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 08:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285256#M86284</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-10T08:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285257#M86285</link>
      <description>&lt;P&gt;Hi IRHM73,&lt;/P&gt;

&lt;P&gt;just had a quick look at it; your subsearch (which is executed first) uses &lt;CODE&gt;user1="Y"&lt;/CODE&gt; but this is set in the &lt;CODE&gt;outer&lt;/CODE&gt; search so this will not match. It will be bed time for me soon - no time to think about this further...maybe tomorrow &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 09:00:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285257#M86285</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-02-10T09:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285258#M86286</link>
      <description>&lt;P&gt;Hi @Mus, thank you for taking the time to look at my post.&lt;/P&gt;

&lt;P&gt;I'll take a look at the query from the comments you made and take it from there.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 09:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285258#M86286</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-10T09:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285259#M86287</link>
      <description>&lt;P&gt;Try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local 
| fields realname, title
| rename title as user
| join user type=left [
   | search index=_audit action="login attempt" earliest=-12mon
   | stats max(timestamp) as _time by user, sourcetype
]
| where isnull(sourcetype)
| fields - sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2016 09:08:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285259#M86287</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-10T09:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285260#M86288</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
Try this search code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/authentication/users splunk_server=local|rename realname as user|fields user|append [search index=_audit action="login attempt" [|rest /services/authentication/users splunk_server=local|rename realname as user| stats count by user] |stats max(timestamp) by user|fields user]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2016 09:53:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285260#M86288</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2016-02-10T09:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285261#M86289</link>
      <description>&lt;P&gt;Hi @javiergn, thank you very much for taking the time to come back to me with this. It was interesting to see you use 'sourcetype' as your count. I hadn't thought about using another field other than  the obvious 'user'.&lt;/P&gt;

&lt;P&gt;This works great!&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 10:01:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285261#M86289</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-10T10:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to identify inactive users over the last 12 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285262#M86290</link>
      <description>&lt;P&gt;Hi @chimell, thank you for taking the time to reply to my post but unfortunately this doesn't work because it returns a list of all the users.&lt;/P&gt;

&lt;P&gt;Please see the solution from @javiergn.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 10:04:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-identify-inactive-users-over-the-last/m-p/285262#M86290</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-10T10:04:37Z</dc:date>
    </item>
  </channel>
</rss>

