Splunk Search

Count of distinct values for emails

hattrells
Engager

I have events coming in from an email spam appliance and would like to have an alert on spam campaigns with a unique sender,subject or content if they exceed a certain number (e.g. 50)

I'm scratching my head trying to create a search to get a count of events with common value for the subject field as a start.

index="mail" | stats dc(subject) as subjectcount | where subjectcount > 50

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

index="mail" 
| stats count dc(recipient) BY subject
| where count > 50

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

index="mail" 
| stats count dc(recipient) BY subject
| where count > 50
0 Karma

hattrells
Engager

This was incredibly easy in the end.... your answer is pretty much what I was trying to get to, only I didn't want to see the count per recipient, only the overall count of distinct subject headers so:

index="mail" | stats count by subject | search count>50

Added an alert which is only triggered when the count is greater than 50 🙂

woodcock
Esteemed Legend

I try to add a little bonus value where I can; sometimes I am off the mark.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...