Security

Search for inactive Splunk users

Ellen
Splunk Employee
Splunk Employee

Is there a search for finding Splunk instance users who have not logged in for X amount of time eg. not logged in for the last 6 months? audit.log contains information on users last login attempt that succeeded. Would a look up setup be the approach?

Tags (3)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

Obviously it's easy to find who has logged in within some past period of time. To find the complement of this, you have to know the full set, i.e., you need a list of all possible users who might have logged in. You can get this either from some canonical external source, or you could generate it by running over an even longer period:

 | inputlookup allusers | search NOT [ index=_audit action="login attempt" info="succeeded" earliest=-6mon | dedup user | fields user ]

or

 index=_audit action="login attempt" info="succeeded" earliest=-18mon latest=-6mon NOT [ index=_audit action="login attempt" info="succeeded" earliest=-6mon | dedup user | fields user ]

You could also generate the lookup on an ongoing basis with a scheduled search:

 index=_audit action="login attempt" info="succeeded" | dedup user | fields user | inputlookup append=t allusers | dedup user | outputlookup allusers

You would run this once over the long past to generate the initial table, then run it every (say) 24 hours over the past 24 hours to keep it up-to-date.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

Obviously it's easy to find who has logged in within some past period of time. To find the complement of this, you have to know the full set, i.e., you need a list of all possible users who might have logged in. You can get this either from some canonical external source, or you could generate it by running over an even longer period:

 | inputlookup allusers | search NOT [ index=_audit action="login attempt" info="succeeded" earliest=-6mon | dedup user | fields user ]

or

 index=_audit action="login attempt" info="succeeded" earliest=-18mon latest=-6mon NOT [ index=_audit action="login attempt" info="succeeded" earliest=-6mon | dedup user | fields user ]

You could also generate the lookup on an ongoing basis with a scheduled search:

 index=_audit action="login attempt" info="succeeded" | dedup user | fields user | inputlookup append=t allusers | dedup user | outputlookup allusers

You would run this once over the long past to generate the initial table, then run it every (say) 24 hours over the past 24 hours to keep it up-to-date.

V_at_Splunk
Splunk Employee
Splunk Employee

You've pretty much answered your own question. Search for source=audit.log endmonthsago=6, and then | DEDUP user.

Splunk makes it easy!    😎

V_at_Splunk
Splunk Employee
Splunk Employee

And anonymous downvoters make one loath to answer questions.

Get Updates on the Splunk Community!

Dashboard Studio Challenge - Learn New Tricks, Showcase Your Skills, and Win Prizes!

Reimagine what you can do with your dashboards. Dashboard Studio is Splunk’s newest dashboard builder to ...

Introducing Edge Processor: Next Gen Data Transformation

We get it - not only can it take a lot of time, money and resources to get data into Splunk, but it also takes ...

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...