Quarantine releases by Detection Types
Description
This query visualises emails released from quarantine and summarizing the result by the original filter verdict
Query · kql
let totalQuery = EmailPostDeliveryEvents | where Action == "Quarantine release" | join kind=inner (EmailEvents | where DeliveryLocation == "Quarantine") on NetworkMessageId | extend MDO_detection = parse_json(DetectionMethods1) | extend FirstDetection = iif(isempty(MDO_detection), "Clean", tostring(bag_keys(MDO_detection)[0])) | extend FirstSubcategory = iif(FirstDetection != "Clean" and array_length(MDO_detection[FirstDetection]) > 0, strcat(FirstDetection, ": ", tostring(MDO_detection[FirstDetection][0])), "No Detection (clean)") | where FirstSubcategory contains "Malware" or FirstSubcategory contains "Phish" or FirstSubcategory contains "Spam" | count; EmailPostDeliveryEvents | where Action == "Quarantine release" | join kind=inner (EmailEvents | where DeliveryLocation == "Quarantine") on NetworkMessageId | extend MDO_detection = parse_json(DetectionMethods1) | extend FirstDetection = iif(isempty(MDO_detection), "Clean", tostring(bag_keys(MDO_detection)[0])) | extend FirstSubcategory = iif(FirstDetection != "Clean" and array_length(MDO_detection[FirstDetection]) > 0, strcat(FirstDetection, ": ", tostring(MDO_detection[FirstDetection][0])), "No Detection (clean)") | where FirstSubcategory contains "Malware" or FirstSubcategory contains "Phish" or FirstSubcategory contains "Spam" | summarize count_messages = count() by FirstSubcategory | project FirstSubcategory, count_messages | order by count_messages desc | render piechart