====== Kusto Query Language (KQL) ======
* #azure #sentinel
* [[azure:qnd:KQL for Resource Graph Explorer]]
* [[https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/sqlcheatsheet]]
* [[https://github.com/reprise99/Sentinel-Queries]]
====== Queries ======
Select records where a column does **not** contain any of the listed substrings
SecurityEvent
| where not(Computer has_any ("mgmt", "imagine"))
Alternate form that works for a single substring match
SecurityEvent
| where not(Computer contains "mgmt")
SecurityEvent
| where Computer !contains "mgmt"
==== List All Tables ====
union withsource = table *
| summarize count() by table
| sort by count_ desc
==== summarize ====
Get a count of records based on summarizing a specified column
Event
| where not(Computer has_any ("mgmt", "imagine"))
| summarize count() by Computer
Get unique values from the specified column
SecurityEvent
| distinct Computer
==== Windows Events Aggregated ====
SecurityEvent
| summarize count() by tostring(EventID), Activity, Computer
| order by count_ desc
==== Palo Alto firewall logs ====
* Aggregating on ApplicationProtocol
* Example of aggregating and sorting
CommonSecurityLog
| summarize count() by ApplicationProtocol
| order by count_ desc
CommonSecurityLog
| summarize Count=count() by ApplicationProtocol
| order by Count desc
====== Related ======
* [[:azure_sentinel|Azure Sentinel]]