Course contentsShow
← Cloud and Infrastructure
Lesson 677 of 2,98912. Monitoring FoundationsFree lesson

Kusto Query Language (KQL) Basics

Introduction to KQL for querying Azure Monitor logs, basic syntax, and common query patterns.

Kusto Query Language (KQL) Basics

You'll learn: How to write basic KQL queries to search and analyze data in Azure Log Analytics Workspaces.

What Is KQL?

Kusto Query Language (KQL) is Azure's purpose-built query language for exploring and analyzing log data in Azure Monitor. Think of it like SQL's specialized cousin designed specifically for time-series data and logs—optimized for fast searches across millions of log entries.

KQL uses a pipeline approach where you chain together operators using the pipe symbol (|). Data flows from left to right, with each operator transforming the results before passing them along—similar to how water flows through connected pipes, getting filtered at each stage.

Basic KQL Syntax

Every KQL query starts with a table name (like your data source), then applies operators:

TableName
| operator1
| operator2
| operator3

Common Query Patterns

Simple search across all logs:

AzureActivity
| where TimeGenerated > ago(1h)
| take 10

Filtering specific conditions:

Heartbeat
| where Computer == "WebServer01"
| where TimeGenerated > ago(24h)

Counting and summarizing:

Syslog
| summarize Count=count() by SeverityLevel

Projecting specific columns:

AzureDiagnostics
| project TimeGenerated, ResourceGroup, OperationName

The where operator filters rows, take limits results, summarize aggregates data, and project selects specific columns—these are your fundamental building blocks for log exploration.

Key Takeaway: KQL uses a pipeline structure where you start with a table and chain operators with | to filter, transform, and analyze log data in Azure Monitor—mastering where, take, summarize, and project gives you powerful log querying capabilities.