Bab 04 Create Queries For Microsoft Sentinel Using Kusto Query Language
Bab 04 Create Queries For Microsoft Sentinel Using Kusto Query Language
● SecurityEvent
● SecurityAlert
● search "err"
● SecurityEvent
● | where TimeGenerated > ago(1h) and EventID == "4624"
● SecurityEvent
● | where TimeGenerated > ago(1h)
● | where EventID == 4624
● | where AccountType =~ "user"
● let LowActivityAccounts =
● SecurityEvent
● | summarize cnt = count() by Account
● | where cnt < 10;
● LowActivityAccounts | where Account contains "Mal"
● SecurityEvent
● | where ProcessName != "" and Process != ""
● | extend StartDir = substring(ProcessName,0,
string_size(ProcessName)-string_size(Process))
● SecurityEvent
● | where ProcessName != "" and Process != ""
● | extend StartDir = substring(ProcessName,0,
string_size(ProcessName)-string_size(Process))
● | order by StartDir desc, Process asc
● SecurityEvent
● | where Computer == "SQL12.NA.contosohotels.com"
● | summarize arg_max(TimeGenerated,*) by Computer
● SecurityEvent
● | where Computer == "SQL12.NA.contosohotels.com"
● | summarize arg_min(TimeGenerated,*) by Computer
● SecurityEvent
● | where EventID == "4624"
● | summarize make_list(Account) by Computer
● SecurityEvent
● | where EventID == "4624"
● | summarize make_set(Account) by Computer
● SecurityEvent Visualizations
● | summarize count() by Account areachart
● | render barchart barchart
columnchart
● SecurityEvent
● | summarize count() by piechart
● SecurityEvent
● | union SigninLogs
● | summarize count()
● | project count_
● SecurityEvent
● | union (SigninLogs | summarize count()| project count_)
● union Security*
● | summarize count() by Type
● SecurityEvent
● | where EventID == "4624"
● | summarize LogOnCount=count() by EventID, Account
● | project LogOnCount, Account
● | join kind = inner (
● SecurityEvent
● | where EventID == "4634"
● | summarize LogOffCount=count() by EventID, Account
● | project LogOffCount, Account
● ) on Account
Extract function:
● SecurityEvent
● | where EventID == 4672 and AccountType == 'User'
● | extend Account_Name = extract(@"^(.*\\)?([^@]*)(@.*)?$", 2, tolower(Account))
● | summarize LoginCount = count() by Account_Name
● | where Account_Name != ""
● | where LoginCount < 10
● Traces
● | parse EventText with * "resourceName=" resourceName ", totalSlices="
totalSlices:long * "sliceNumber=" sliceNumber:long * "lockTime=" lockTime ",
releaseTime=" releaseTime:date "," * "previousLockTime=" previousLockTime:date
")" *
● | project resourceName, totalSlices, sliceNumber, lockTime, releaseTime,
previousLockTime
● SigninLogs
● | extend OS = DeviceDetail.operatingSystem
● Users
● | where UserID in ((externaldata (UserID:string) [
● @"https://storageaccount.blob.core.windows.net/storagecontainer/users.txt"
● h@"?...SAS..." // Secret token needed to access the blob
● ]))
● | ...
● SecurityEvent
● | where EventID == 4672 and AccountType == 'User'
● PrivLogins