<?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 Help on query for user login info. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-on-query-for-user-login-info/m-p/99672#M25696</link>
    <description>&lt;P&gt;I have file which has a set of all users and roles with the Splunk account.The file name is usermap.csv&lt;/P&gt;

&lt;P&gt;I am using the following query to get all users who have logged in the last 30 days.&lt;/P&gt;

&lt;P&gt;*index=_audit action="login attempt" info="succeeded" earliest=-30d | stats max(timestamp) by user | lookup usermap.csv user OUTPUT role1,role2,role3,role4 | eval role2 = if(isnull(role2),"", ", ".role2 ) | eval role3 = if(isnull(role3),"", ",".role3 ) | eval role4 = if(isnull(role4),"", ", ".role4 )  | strcat role1  role2 role3  role4 Role | fields
user,max(timestamp),Role | rename user as "UserName",max(timestamp) as "Last Login", Role as "Roles"*&lt;/P&gt;

&lt;P&gt;Since I have the complete set of users in the lookup file. I am getting the list of users who had not logged in he last 30 days using the following query.&lt;/P&gt;

&lt;P&gt;*| inputlookup usermap.csv | search NOT [ search index=_audit action="login attempt" info="succeeded" earliest=-30d | dedup user | fields user] | fields user*&lt;/P&gt;

&lt;P&gt;How Do I get the last login information and roles for the second query.i.e for the users who did not login for the last 30 days.May be I should use the join.But I am not getting it right.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Dec 2010 22:22:54 GMT</pubDate>
    <dc:creator>sanju005ind</dc:creator>
    <dc:date>2010-12-06T22:22:54Z</dc:date>
    <item>
      <title>Help on query for user login info.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-query-for-user-login-info/m-p/99672#M25696</link>
      <description>&lt;P&gt;I have file which has a set of all users and roles with the Splunk account.The file name is usermap.csv&lt;/P&gt;

&lt;P&gt;I am using the following query to get all users who have logged in the last 30 days.&lt;/P&gt;

&lt;P&gt;*index=_audit action="login attempt" info="succeeded" earliest=-30d | stats max(timestamp) by user | lookup usermap.csv user OUTPUT role1,role2,role3,role4 | eval role2 = if(isnull(role2),"", ", ".role2 ) | eval role3 = if(isnull(role3),"", ",".role3 ) | eval role4 = if(isnull(role4),"", ", ".role4 )  | strcat role1  role2 role3  role4 Role | fields
user,max(timestamp),Role | rename user as "UserName",max(timestamp) as "Last Login", Role as "Roles"*&lt;/P&gt;

&lt;P&gt;Since I have the complete set of users in the lookup file. I am getting the list of users who had not logged in he last 30 days using the following query.&lt;/P&gt;

&lt;P&gt;*| inputlookup usermap.csv | search NOT [ search index=_audit action="login attempt" info="succeeded" earliest=-30d | dedup user | fields user] | fields user*&lt;/P&gt;

&lt;P&gt;How Do I get the last login information and roles for the second query.i.e for the users who did not login for the last 30 days.May be I should use the join.But I am not getting it right.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2010 22:22:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-query-for-user-login-info/m-p/99672#M25696</guid>
      <dc:creator>sanju005ind</dc:creator>
      <dc:date>2010-12-06T22:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help on query for user login info.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-query-for-user-login-info/m-p/99673#M25697</link>
      <description>&lt;P&gt;Well I used something like this.Atleast I was able to get what I want.&lt;/P&gt;

&lt;P&gt;| inputlookup usermap.csv | search NOT [ search index=_audit action="login attempt" info="succeeded" earliest=-30d | dedup user | fields user] | fields user | join user [search index=_audit action="login attempt" info="succeeded" earliest=-90d ] | stats max(timestamp) by user | lookup usermap.csv user OUTPUT role1,role2,role3,role4 | eval role2 = if(isnull(role2),"", ", ".role2 ) | eval role3 = if(isnull(role3),"", ",".role3 ) | eval role4 = if(isnull(role4),"", ", ".role4 )  | strcat role1  role2 role3  role4 Role | fields user,max(timestamp),Role | rename user as "UserName",max(timestamp) as "Last Login", Role as "Roles"&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2010 23:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-query-for-user-login-info/m-p/99673#M25697</guid>
      <dc:creator>sanju005ind</dc:creator>
      <dc:date>2010-12-08T23:38:11Z</dc:date>
    </item>
  </channel>
</rss>

