Splunk Search

How to search the count of all users that have had a specific status for at least X days?

egreibl
Engager

Hi together,

Hope you can help me.

I have the following - every day I'll receive user data, and I want to count all users with a specific Status. Then I want to count the status over the last 30 days to see if some users do have the status for at least 30 days long:

Time=Last 30 days

sourcetype=XYZ | search userstatus="Transition" | stats count by user

Now I can put this in a table:

|table user, count

Example:

user1 | 30
user2 | 30
user3 | 30
user4 | 29
user5 | 1

But what I want to have is a single value. For this example, the result should be: 3 --> because 3 users do have the status for at least 30 days long.

Can someone help me - I think this is really easy, but I do have knot in my head now 😄

thanks, br, Lisi

0 Karma

sundareshr
Legend

You can filter is using the where clause. Like this

sourcetype=XYZ userstatus="Transition" | stats count by user | where count>=30 
0 Karma

egreibl
Engager

thanks so much! was really easy 😄

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...