Spam detection by delivery location
Description
This query visualises total emails with Spam detections over time summarizing the data daily by Delivery Location.
Query · kql
EmailEvents | where Timestamp > ago(30d) | where OrgLevelPolicy != "Phishing simulation" and OrgLevelPolicy != "SecOps Mailbox" | where DetectionMethods has "Spam" and EmailDirection == "Inbound" | extend Key = strcat(NetworkMessageId, '-', RecipientEmailAddress) | summarize arg_max(Timestamp, *) by Key | make-series TotalSpamDetections=count(),Quarantine = countif(DeliveryLocation == "Quarantine"),Junkfolder=countif(DeliveryLocation == "Junk folder"),Inbox=countif(DeliveryLocation == "Inbox/folder"),Failed=countif(DeliveryLocation == "Failed"),Dropped=countif(DeliveryLocation == "Dropped") default = 0 on Timestamp step 1d // | render timechart // Uncomment this line to render as a graph