Splunk Search

'Stats count by' set to specific count?

bcjammer03
Explorer

I'm trying to create a query where I get results of a specific user triggering two of the same alerts. Is there a way to set 'stats count by' to equal 2, that results will show only users that have triggered this alert twice?

Or is there a specific command that will allow me to do this?

index=`email` action=blocked | stats count by user_ID

Labels (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There is no specific command for that, but there is a simple combination of commands.

index=`email` action=blocked 
| stats count by user_ID
| where count > 1
---
If this reply helps you, Karma would be appreciated.

bcjammer03
Explorer

yes! thank you @richgalloway 

0 Karma

isoutamo
SplunkTrust
SplunkTrust
Small fix as @bcjammer03 asked "triggered twice" you should use "| where count = 2"

richgalloway
SplunkTrust
SplunkTrust

That is a more precise match to the requirements, but I presumed "thrice" is just as interesting as "twice".

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting V2

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...