Dynamics 365 Business Central: filtering telemetry signals with Azure Monitor Data Collection Rules

One of the main issues on using Azure Application Insights for collecting telemetry from a Dynamics 365 Business Central tenant is that it’s not possible to filters telemetry signals on the source. When you connect Application Insights to a Dynamics 365 Business Central tenant, all telemetry signals sent from Dynamics 365 Business Central are automatically sent to your Application Insights instance, and this essentially means two things:

  • you have lots of signals in your telemetry store and maybe you’re not interested on some of them
  • the volume of the ingested telemetry grows a lot (and remember that you pay for this volume, so remember to set a daily cap).

But now, there’s an interesting new feature, currently in public preview at the time of writing this post: it’s now possible to set a Data Collection Rule on Application Insights to your ingested signals and you can apply a rule in order to receive only the signals that you’re interested to collect.

Data Collection Rules (DCRs) define the data collection process in Azure Monitor. DCRs specify what data should be collected, how to transform that data, and where to send that data. A single DCR can be used with multiple monitored resources, giving you a consistent method to configure a variety of monitoring scenarios.

One of the most valuable features of the new data collection process is data transformations, which allow you to apply a KQL query to incoming data to modify it before sending it to its destination. You might filter out unwanted data or modify existing data to improve your query or reporting capabilities.

How can we use this new feature with Dynamics 365 Business Central in order to apply a rule for receiving only the telemetry signals that we want?

Open your Azure Application Insights instance and click on the workspace name associated to it:

In your workspace instance, select the Tables (preview) option under Settings:

Here you have a list of Azure Application Insights tables that compose your telemetry store. Select the table called AppTraces, right click on it and select Create transformation:

Here create a new data collection rule (give it a name) and then click on Next

In the Schema and transformation pane, click on Tranformation editor:

A Log Analytics windows will be opened. Here you can write a KQL query to apply a rule to the telemetry signals that you want receive.

As an example, imagine that I want to receive only the event id called RT0008 (web services calls) and RT0018 (long running AL methods). I can apply the followint transformation rule:

source
| where Properties.eventId == 'RT0008' 
or Properties.eventId == 'RT0018'

You can test your transformation rule and checking if the filter works. When done, click Apply. Then click on Create and the rule is deployed.

You can check if the rule is correctly applied to the Application Insights table by right-clicking the table and select Manage table:

In this example I’ve applied a rule for filtering signals by eventId (top request by partners), but you can also apply other different filters accordingly to your needs.

I think that Data Collection Rules on Application Insights signals are a nice way to save costs when using Dynamics 365 Business Central telemetry. I know that lots of partners asked in the past to have the possibility to set filters on signals at tenant level (directly in the Admin Center), but at the moment you can do the same in this way and I think it’s absolutely well manageable.

Give it a try…

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.