Query Details
let query_frequency = 1h;
let query_period = 14d;
let _DomainControllers = toscalar(
_GetWatchlist("Service-PrivateCorporateServices")
| where Service == "DomainController"
| summarize make_list(HostName)
);
SecurityEvent
| where TimeGenerated > ago (query_period)
| where EventID == 4624 and AccountType == "User" and Computer has_any (_DomainControllers)
| summarize arg_min(TimeGenerated, *) by
LogonTypeName,
AuthenticationPackageName,
LmPackageName,
EmptyIpAddress = IpAddress in ("-", ""),
EmptyWorkstationName = WorkstationName in ("-", ""),
ElevatedToken,
IsAnonymousLogon = TargetAccount == @"NT AUTHORITY\ANONYMOUS LOGON"
| where TimeGenerated > ago(query_frequency)
| project
TimeGenerated,
Computer,
Account,
AccountType,
Activity,
LogonTypeName,
AuthenticationPackageName,
LmPackageName,
KeyLength,
EmptyIpAddress,
EmptyWorkstationName,
ElevatedToken,
IsAnonymousLogon
This query is designed to analyze security events related to user logins on domain controllers over a specified period. Here's a simplified breakdown:
Setup Parameters:
query_frequency is set to 1 hour, meaning the query focuses on events from the last hour.query_period is set to 14 days, indicating the overall time range for data consideration.Identify Domain Controllers:
Filter Security Events:
SecurityEvent table) that occurred within the last 14 days.EventID 4624, which indicates a successful logon, and where the AccountType is "User".Summarize Events:
arg_min) of each unique combination of logon type, authentication package, and other attributes.Recent Events:
Select Output Columns:
In essence, this query helps identify and analyze recent user logon activities on domain controllers, focusing on specific attributes and conditions.

Jose Sebastián Canós
Released: March 18, 2026
Tables
Keywords
Operators