Splunk Search

How to search for users who haven't signed in to an app over the last 30 days.

stegray93
Explorer

Hello,

I'm trying to figure out the search that would be needed to find any users who haven't logged in to an application over the last 30 days.

I don't really know what to give as an example as I've tried multiple different ways and none of them work.

So basically the core of the search is below.

source=okta:event action.message="Sign-in successful"

How do I then make this only show me results of users who haven't created a sign-in successful event in the last 30 days? Then table them as user.

Tags (1)
0 Karma
1 Solution

sundareshr
Legend

Let's assume you have a field called userid. Try this search.

source=okta:event action.message="Sign-in successful" | stats latest(_time) as LastLogin by userid | where LastLogin<relative_time(now(), "-30d")

View solution in original post

sundareshr
Legend

Let's assume you have a field called userid. Try this search.

source=okta:event action.message="Sign-in successful" | stats latest(_time) as LastLogin by userid | where LastLogin<relative_time(now(), "-30d")

stegray93
Explorer

thanks it's seem to of worked. Do you know how I can change the LastLogin field to look more user friendly? It's currently displaying it as a load of numbers, can I get that show the date of the last time they logged in?

0 Karma

woodcock
Esteemed Legend

Add this:

... | fieldformat LastLogin = strftime(LastLogin, "%m/%d/%Y %H:%M:%S")
0 Karma

stegray93
Explorer

Awesome, thanks guys you've made my day 😄

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...