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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...