Email Top 15 Domains sending Spam with Additional Details
Description
This query visualises total inbound emails with Spam detections summarizing the data by the top 15 email sender P2 domain (SenderFromDomain).
Query · kql
//This query visualises total inbound emails with Spam detections summarizing the data by the top 15 email sender P2 domain (SenderFromDomain). Adding additional insights for total inbound emails and bad traffic percentage for each sender domain.
EmailEvents
| where EmailDirection == "Inbound"
| where Timestamp > ago(30d) // last 30 days by default, replace 30d with the desired period
| summarize TotalEmailCount = count(),
SpamEmailCount = countif(ThreatTypes has "Spam") by SenderFromDomain
| extend Bad_Traffic_Percentage_Inbound = todouble(round(SpamEmailCount / todouble(TotalEmailCount) * 100, 2))
| where SpamEmailCount !=0
| sort by SpamEmailCount desc
| project SenderFromDomain,SpamEmailCount,TotalEmailCount,Bad_Traffic_Percentage_Inbound
| top 15 by SpamEmailCount