Cheatsheet: Real-Time Intelligence, Eventstreams & KQL
Cheatsheet: Real-Time Intelligence, Eventstreams & KQL
Source
- Content type: Quick-Reference Cheatsheet
- Target Exam: Exam DP-700
- Date captured: 2026-08-15
- Last reviewed: 2026-08-15
1. Eventstream Ingestion & Routing
- Sources: Custom App (Kafka/REST), Azure Event Hubs, Azure IoT Hub, Amazon Kinesis, Database CDC.
- Destinations: KQL Database (Eventhouse), Lakehouse (Delta Table), Custom App / Reflex (Data Activator).
- Transformations: Filter, Manage Fields, Aggregate (Tumbling/Hopping/Sliding windows), Union, Expand JSON arrays.
2. KQL Core Tabular Operators
// 1. Time-bucketed Aggregation with Early FilteringDeviceTelemetry| where Timestamp between (ago(7d) .. now())| where Status == "Active"| summarize AvgTemp = avg(Temperature), MaxTemp = max(Temperature), TotalCount = count() by DeviceId, bin(Timestamp, 1h)| top 10 by MaxTemp desc
// 2. Joining Streaming Tables with Lookup DimensionDeviceTelemetry| where Timestamp > ago(24h)| lookup kind=inner (DeviceMetadata | project DeviceId, Location, FirmwareVersion) on DeviceId| project Timestamp, DeviceId, Location, Temperature, Status
// 3. String & Dynamic JSON ParsingRawLogs| where Timestamp > ago(1d)| extend ParsedJson = parse_json(LogPayload)| extend EventCode = tostring(ParsedJson.header.code), ErrorMsg = tostring(ParsedJson.body.error)| where isnotempty(ErrorMsg)| project Timestamp, EventCode, ErrorMsg3. KQL Update Policy & Materialized Views
// Step 1: Create Curated Target Table.create table CuratedTelemetry (Timestamp: datetime, DeviceId: string, Temperature: real)
// Step 2: Define Transformation Function.create-or-alter function ProcessTelemetry() { RawTelemetry | where Temperature > -40 and Temperature < 120 | project Timestamp = todatetime(RawData.timestamp), DeviceId = tostring(RawData.deviceId), Temperature = toreal(RawData.temp)}
// Step 3: Attach Update Policy (Target Table).alter table CuratedTelemetry policy update@'[{ "IsEnabled": true, "Source": "RawTelemetry", "Query": "ProcessTelemetry()", "IsTransactional": true }]'4. KQL Performance Optimization & Time-Series Analytics
Query Optimization Rules
- Early Filtering: Always place
| where Timestamp > ago(...)at the very beginning of the pipeline. The Kusto engine uses extent metadata to prune entire storage shards before loading data into memory. - Project Early: Use
| projectto eliminate unneeded high-cardinality columns before executingjoinorsummarize. - Use
lookupoverjoin: When enriching fact tables with small dimension/lookup tables, use| lookup(optimized for broadcast) instead of standardjoin.
Time-Series Anomaly Detection
// Build regular time-series grid and decompose anomaliesDeviceMetrics| where Timestamp between (ago(14d) .. now())| make-series AvgMetric = avg(MetricValue) default=0 on Timestamp from ago(14d) to now() step 1h by DeviceId| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(AvgMetric, 1.5, -1, 'linefit')| render anomalychart with(anomalycolumns=Anomalies, title='Metric Anomaly Detection')