Splunk Search

How to count events based on a user name, not the events

NewGhost
Engager

Hi,

I'm struggling with a simple search.

I have multiple events for the same username. I need to count the number of usernames that appeared in those events. I start with just 1 day when there should be only 1 username. But this search returns the count of 7, because it counts events, not usernames, even though I put the username field in the count command:

index=* policy_name=* | stats count(username)

 

I tried adding dedup before stats, but it didn't do anything. What am I missing, please?

 

Thanks,

Alina

 

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try this

| stats dc(username)

NewGhost
Engager

That's it.

Thanks

0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...