Spam detection by IP and its location
Description
This query visualises total emails with Spam detections summarizing the data by email sender IP address (SenderIPv4, SenderIPv6).
Query · kql
//This query visualises total emails with Spam detections summarizing the data by email sender IP address (SenderIPv4, SenderIPv6). let ipv4position = EmailEvents | where ThreatTypes has "Spam" | where TimeGenerated > ago(90d) // last 30 days by default, replace 30d with the desired period | where SenderIPv4 != "" | summarize count() by SenderIPv4 | extend GeoInfo = geo_info_from_ip_address(SenderIPv4) | extend Latitude = tostring(GeoInfo.latitude), Longitude = tostring(GeoInfo.longitude) | project SenderIPv4, Latitude, Longitude, count_; let ipv6position = EmailEvents | where ThreatTypes has "Spam" | where TimeGenerated > ago(90d) // last 30 days by default, replace 30d with the desired period | where SenderIPv6 != "" | summarize count() by SenderIPv6 | extend GeoInfo = geo_info_from_ip_address(SenderIPv6) | extend Latitude = tostring(GeoInfo.latitude), Longitude = tostring(GeoInfo.longitude) | project SenderIPv6, Latitude, Longitude, count_; ipv4position | union ipv6position | project SenderIPv6, SenderIPv4, Latitude, Longitude, count_;