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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...