Syntax and Query Structure

Some important rules:

  1. You can put as many spaces you want btw the pipe and the command

cluster('help').database('SecurityLogs').Email
|     where subject == "jasade"
  1. You can put many pipe commands in one line

cluster('help').database('SecurityLogs').Email
| where subject == "jasade" | sort by event_time asc
  1. Double slash to comment '//'

//this is a comment
cluster('help').database('SecurityLogs').Email
| where subject == "jasade" | sort by event_time asc
  1. KQL is mostly case-sensitive

  2. No quotes around field names

Comparison operators

  • == equals to

  • != not equal to

  • =~ not case sensitive

Query order

How you filter your data matters!

If you filter first for the random 10 rows with 'take 10' and after that you search for all the users named 'peter' you wont get the same result as if you first searched for the name peter and than took random 10 rows.

Last updated