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!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...