Share via

Sentinel Incident KQL

SUNOJ KUMAR YELURU 18,166 Reputation points MVP Volunteer Moderator
2026-03-27T06:24:52.2566667+00:00

Hi,

My exisiting KQL, here i want to include only hostname

SecurityIncident
| where CreatedTime between (datetime(2026-03-17) .. datetime(2026-03-23))
| where Status contains "Closed"
| project
    IncidentNumber,
    LastModifiedTime,
    CreatedTime,
    Title,
    Severity,
    Status,
    Owner,
    Classification,
    ClassificationReason,
    ClassificationComment
Microsoft Security | Microsoft Sentinel
0 comments No comments

Answer accepted by question author
  1. VEMULA SRISAI 11,330 Reputation points Microsoft External Staff Moderator
    2026-03-27T07:15:47.6+00:00

    Hello SUNOJ KUMAR YELURU,

    In Sentinel, SecurityIncident doesn’t expose Entities anymore—it only stores the linked alert references in AlertIds. To get hostnames, you need to expand AlertIds and join with SecurityAlert, because SecurityAlert is the table that contains Entities (and the join key is SystemAlertId).

    https://learn.microsoft.com/en-in/azure/sentinel/entities-reference?

    https://learn.microsoft.com/en-us/azure/sentinel/security-alert-schema

    Use the below query to return only hostnames for Closed incidents in your date range:


    SecurityIncident
    | where CreatedTime between (datetime(2026-03-17) .. datetime(2026-03-23))
    | where Status has "Closed"
    | summarize arg_max(TimeGenerated, *) by IncidentNumber
    | mv-expand AlertIds to typeof(string)
    | join kind=inner (
        SecurityAlert
        | project SystemAlertId, Entities
    ) on $left.AlertIds == $right.SystemAlertId
    | extend E = todynamic(Entities)
    | mv-expand E
    | where tostring(E.Type) =~ "host"
    | extend Hostname = coalesce(tostring(E.HostName), tostring(E.FQDN), tostring(E.Name))
    | where isnotempty(Hostname)
    | distinct Hostname
    | order by Hostname asc
    

    Note: If an incident’s underlying alerts don’t contain a Host entity, no hostname will be returned (connector/provider dependent).

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.