Analyze telemetry with KQL
Purposeful events become diagnostic evidence when you query them as a sequence rather than isolated rows. Business Central custom AL events and most diagnostic signals appear in the Application Insights traces table. Page-view telemetry appears in pageViews. These examples use the Application Insights Logs schema; querying the underlying Log Analytics workspace uses table and column names such as AppTraces, TimeGenerated, and Properties.
Normalize trace dimensions for analysis
Kusto Query Language (KQL) treats customDimensions as a dynamic property bag. Convert the properties you compare, group, or display with tostring(). This conversion avoids implicit type behavior and gives the projected columns predictable scalar values.
traces
| extend EventId = tostring(customDimensions.eventId),
ExtensionName = tostring(customDimensions.extensionName),
EnvironmentName = tostring(customDimensions.environmentName),
EnvironmentType = tostring(customDimensions.environmentType),
OperationId = tostring(customDimensions.alOperationId),
Result = tostring(customDimensions.alResult),
FailureReason = tostring(customDimensions.alFailureReason)
| where EventId in ("ALMTE001", "ALMTE002", "ALMTE003")
| project timestamp, EventId, ExtensionName, EnvironmentName,
EnvironmentType, OperationId, Result, FailureReason, message
| order by timestamp asc
The query uses the emitted names, including the AL event-ID prefix and al custom-dimension prefix. It also projects extensionName and environment fields so you can confirm that a result belongs to the intended app and sandbox.
Application Insights records timestamp in Coordinated Universal Time (UTC). Set the Logs time range wide enough to include the operation, and account for your local offset when you compare telemetry with a test record. Keep UTC in shared investigation notes so collaborators don't interpret the same event as different times.
Correlate one operation sequence
A shared operation GUID turns lifecycle events into a sequence. To inspect one execution, copy its nonempty operation identifier and filter all related rows:
let targetOperationId = "00000000-0000-0000-0000-000000000000";
traces
| extend EventId = tostring(customDimensions.eventId),
OperationId = tostring(customDimensions.alOperationId),
Result = tostring(customDimensions.alResult),
FailureReason = tostring(customDimensions.alFailureReason)
| where EventId startswith "ALMTE"
| where OperationId == targetOperationId
| project timestamp, EventId, Result, FailureReason, message
| order by timestamp asc
Replace the zero GUID with an identifier returned by the first query. Copy the exact emitted identifier, including any braces produced by AL formatting. This query compares strings. The custom alOperationId dimension is application-defined and is separate from Application Insights operation_Id. Related platform events will not automatically contain it. A successful execution has started and succeeded events. A failed execution has started and failed events. Missing terminal events can indicate an uninstrumented path, an interruption, sampling, or ingestion delay. The query alone doesn't prove which explanation applies.
Diagnose patterns before selecting an action
Summarize outcomes before you change code or create an alert:
traces
| extend EventId = tostring(customDimensions.eventId),
ExtensionName = tostring(customDimensions.extensionName),
EnvironmentName = tostring(customDimensions.environmentName),
Result = tostring(customDimensions.alResult),
FailureReason = tostring(customDimensions.alFailureReason)
| where EventId in ("ALMTE002", "ALMTE003")
| summarize EventCount = count()
by ExtensionName, EnvironmentName, Result, FailureReason, bin(timestamp, 15m)
| order by timestamp desc
EventCount counts terminal trace records, not distinct operation GUIDs or a failure-rate percentage. Duplicated or sampled events can affect counts. Establish the relevant operation population and data completeness before interpreting counts as operation rates.
Interpret the result in context. A repeated failure category in one environment might justify a code correction or configuration check. A sudden rate change across environments might justify an alert. A single expected validation failure usually belongs in an investigation record rather than an urgent alert.
Use the evidence chain explicitly: identify the environment and extension, correlate an operation, classify its result, then state the supported diagnosis. For more query patterns and the Business Central telemetry schema, see Monitor and analyze telemetry and Analyzing Business Central telemetry in Application Insights.