Building KQL Workbooks for Retail Operations from BC Telemetry
200+ ready-made queries. That is the size of the BCTech KQL query library for Business Central telemetry in Application Insights, organised by functional and signal area. For a retail operations team, the useful move is not opening a blank Logs page and guessing. It is starting from that library, picking the signal areas that match store operations, and arranging the results as an Azure Monitor Workbook that can be filtered and drilled into.
Business Central telemetry is stored in Azure Application Insights in the traces and pageViews tables, and it is queried with Kusto Query Language, shortened to KQL. A workbook does not create new telemetry. It organises queries against data that is already landing in those tables, so the first decision is which surface fits the question.
Workbook, dashboard, or alert: three surfaces, three jobs
These surfaces overlap, and that overlap causes wasted building. Each one answers a different kind of question.
Workbook first. Azure Monitor Workbooks support parameters and conditional visibility for interactive investigation and drill-down. That makes a workbook the right home for an investigation that changes shape as it runs: narrow the scope, look at a failure group, then drill further into the same view. The retail operations workbook belongs here, because a posting failure rarely arrives with its scope already known.
Dashboard second. Log query results and metrics charts can be pinned to shared Azure dashboards. A dashboard is a display surface, not an investigation surface. Pin a tile only after its query has settled in the workbook and the number on it has been checked. Pinning an unchecked query just publishes the error wider.
Alert third. KQL alert rules can detect failure spikes and performance degradation. An alert needs a threshold worth waking someone for, and a workbook tile behind it so the person responding can investigate instead of staring at a count. Build the tile, verify it, then consider the alert.
| Surface | What the sources support | Use it for |
|---|---|---|
| Workbook | Parameters and conditional visibility for interactive investigation and drill-down | The working retail operations view, still being questioned |
| Azure dashboard | Log query results and metrics charts can be pinned to shared Azure dashboards | Settled tiles a wider group should see |
| KQL alert rule | Can detect failure spikes and performance degradation | A verified signal that needs a response, not just a view |
| Power BI, notebooks | Kusto queries can also be used in Power BI reports and Jupyter Notebooks (Kqlmagic) | Analysis that leaves Application Insights entirely |
Start from the library, not from memory
Microsoft Learn documents a starter pattern for telemetry queries, and it is deliberately plain:
traces
| where timestamp > ago(7d)
| take 100
| project timestamp, message, customDimensions
| sort by timestamp desc
Read that pattern closely, because it sets the honest limits for the rest of the build. It reads from traces. It bounds the window to the last seven days. It limits the result set. It projects three things: timestamp, message, and customDimensions. Any workbook tile that claims more precision than the underlying query supports is decoration, not evidence.
The BCTech library then supplies the signal-specific queries. Its map includes version tracking per signal, which matters when a query written for one version is reused after an upgrade. Check the signal version before copying a query into a workbook that other people will trust.
The retail-relevant signal areas
Four signal areas from the library map carry most of the retail operations value. The rest of the library stays available, but these four earn workbook tiles first.
- Error Dialogs, RT0030. The error signal. In a retail workbook this is the tile group for failures surfacing to users, including the posting and statement errors an operations team gets called about.
- Long Running SQL, RT0005. The slow-operation signal. Long-running operations are the telemetry shape of a back-office task or a store process that feels stuck long before anyone files a ticket.
- Report Execution, RT0006 and RT0007. The report signals. Statement and report runs that fail or drag belong in the workbook next to the error tiles, not in a separate hunt through Logs.
- Web Service Requests, RT0008. The integration signal. Where retail data moves through web service calls, this area shows whether a problem sits in Business Central itself or in the traffic around it.
Notice what is missing from that list: any claim about a specific store, company, or terminal. The library organises queries by signal area. Turning a signal into a retail view requires the filtering step, and that step uses the fields the telemetry actually carries.
Filters come from customDimensions
The starter query projects customDimensions alongside timestamp and message. That is the field set a workbook builder works with when scoping a tile: the dimensions attached to each telemetry record are what separate one slice of operations from another.
Two design rules follow.
- Keep the base query shape close to the documented starter pattern: read from traces, bound the time window, and project timestamp, message, and customDimensions.
- Put the workbook parameters, which Azure Monitor Workbooks support, in front of the tiles rather than hard-coding one scope into every query. One workbook should serve more than one investigation.
- Use conditional visibility, which workbooks also support, to hide drill-down sections until a parameter selects them. A tile nobody has asked for yet should not crowd the first screen.
What success looks like: changing a workbook parameter changes the tiles on the page, and a hidden drill-down section appears only when its controlling parameter is set. If the page looks identical after a parameter change, the parameter is decoration and the tiles are still hard-scoped.
Assemble the workbook in order
- Start in Application Insights Logs with the documented starter query against traces, and confirm telemetry rows return for the chosen window.
- Open the BCTech KQL library and select the queries for RT0030, RT0005, and RT0006/RT0007 first, checking the version tracking shown for each signal.
- Create the workbook and add one tile group per signal area: errors, long-running operations, and report executions. Add RT0008 only where web service traffic is part of the operation being watched.
- Add workbook parameters above the tile groups and wire conditional visibility so drill-down sections stay hidden until selected.
- Keep each tile's query traceable back to its library source. A tile with no known origin cannot be rechecked after an upgrade.
- Only after the tiles verify (next section), pin settled results to a shared Azure dashboard, and consider KQL alert rules for the failure signals.
Verify one tile before trusting any of them
A workbook count is a claim. Test it like one.
- Pick the error tile and note the count it shows for its window.
- Run the documented starter query pattern in Logs for the same window and confirm traces rows exist underneath the tile.
- Compare the timestamp and message values the query returns against what the tile presents. The tile should be a view of those rows, not a different population.
- Change the time window in both places. Both numbers should move, and they should move consistently.
What success looks like: the workbook tile and the Logs query describe the same telemetry for the same window, and a window change moves both. If the tile stays fixed while the query moves, the workbook is showing a pinned or stale result, and nothing else on the page should be quoted until that is fixed.
The decision rule for the whole build is short. Workbook while investigating, dashboard once a tile is settled and verified, alert only when a verified signal needs a response. Queries can also travel to Power BI reports, Azure Dashboards, alerts, and Jupyter Notebooks, so a query that earns its place in the workbook is not trapped there. Start from the library, keep every tile traceable to it, and let the surfaces graduate in that order.
, Dex Carter, Tech Writer
IndexBack to all guides →