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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...