Splunk Search

Counting the results of a Search?

MichaelCohen829
Explorer

Hello Splunk Community

I am trying to create a Search that will count the number of users who have a passed a certain number of threshold. In this case, I want to count the number of distinct UserIDs that has logged on more than 4 times.

The search I have so far will return each UserID and the number of times this User has logged in, only returning those who have logged in more than 4 times. What I want to do now is to do a count of those UserIDs, in other words I would like to search to return one number, then number of users who have logged in more than 4 times.

Any ideas?

Thanks,

Mike

sourcetype="logfile" Action="LoggedIn" | stats dc(StartTime) as xcount by UserId | where xcount>4 | sort xcount desc

Tags (1)
0 Karma

lguinn2
Legend

This will do it

sourcetype="logfile" Action="LoggedIn" 
| stats dc(StartTime) as xcount by UserId 
| where xcount>4 
| stats count as "Number of Users Who have Logged in More than 4 Times"
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...