KQL Cheatsheet

Free searchable KQL (Kusto) cheatsheet for Log Analytics, Microsoft Sentinel and Defender: where, summarize, bin, join, parse, mv-expand and charts.

Frequently asked questions

What is the difference between has and contains?

has matches whole terms, such as a word between spaces or punctuation, and uses the table index, so it is fast. contains matches any part of a string and has to scan the text, so it is slower on large tables. Use has where you can.

Is KQL case-sensitive?

Table names, column names and operators are case-sensitive. String comparisons depend on the operator: == is case-sensitive and =~ is not; has, contains, startswith and in~ ignore case, and their _cs forms do not.

Why is sort by descending?

In KQL, sort by (and order by) sorts from highest to lowest unless you add asc. That is the opposite of SQL, where ORDER BY is ascending by default.