Edit

Share via


Migrate from logs-based to OpenTelemetry metrics for Azure virtual machines

The metrics-based experience should be your default monitoring option for virtual machines in Azure Monitor because it's available at no cost. If you already have the older logs-based experience enabled, the next decision is whether you need to keep it enabled and when you can retire it. Because the logs-based experience includes data ingestion and retention charges, you should retire it as soon as possible to optimize costs. This article helps you make that decision and walks through the migration process when you can retire the logs-based experience.

Note

The metrics-based experience is currently in public preview.

Considerations

  • Data retention: Removing the logs-based DCR association stops new data collection but doesn't delete historical data in your Log Analytics workspace. Historical data remains available according to your workspace retention settings.
  • Cost optimization: The default metrics-based experience is free. Retiring the logs-based experience can reduce Log Analytics ingestion costs.
  • Azure Monitor agent: You don't need to reinstall or update the Azure Monitor agent. The same agent handles both logs-based and OpenTelemetry metrics collection using different DCRs.
  • Run both experiences temporarily if needed: Keep both experiences enabled only long enough to validate replacement queries and dashboards.

When to keep the logs-based experience

Keep the logs-based experience enabled if any of the following are still true:

  • You need to monitor VM Scale Sets.
  • You rely on the built-in multi-VM dashboards and workbooks in VM insights.
  • You need to correlate metrics and logs in a single KQL query.
  • You still use queries, alerts, dashboards, or workbooks that depend on the InsightsMetrics table.

If none of these apply, you can retire the logs-based experience and keep the metrics-based experience enabled.

Before you retire the logs-based experience

Before you retire the logs-based experience, confirm the following:

  • Metrics-based monitoring is already enabled for each VM.
  • The metrics-based experience shows the performance data that you need.
  • You don't need the built-in multi-VM experience.
  • Any KQL queries, alerts, dashboards, or workbooks that use InsightsMetrics have been updated, retired, or replaced.

Migration process

Use the following process to retire the logs-based experience:

  1. Confirm that metrics-based monitoring is already enabled.
  2. Validate that the metrics-based experience meets your monitoring requirements.
  3. Update or retire dependencies on InsightsMetrics.
  4. Remove the logs-based DCR association.

Confirm that metrics-based monitoring is enabled

This article doesn't cover initial setup. If you haven't enabled metrics-based monitoring yet, use one of these articles first:

After setup, return to this article to decide whether you can retire logs-based collection.

Validate the metrics-based experience

Before you remove logs-based collection, verify that the metrics-based experience provides the data you need.

  1. Go to the VM in the Azure portal and select Monitor.
  2. Select the metrics-based experience in the experience selector.
  3. Confirm that the performance charts show data.
  4. If needed, go to the Azure Monitor workspace and verify that metrics such as system.cpu.time and system.memory.usage are available.

Update dependencies

Before you remove the logs-based DCR association, update or retire dependencies on logs-based metrics.

Update queries

Queries must change from KQL against Log Analytics to PromQL against the Azure Monitor workspace.

Logs-based KQL query example:

InsightsMetrics
| where TimeGenerated > ago(1h)
| where Namespace == "Processor" and Name == "UtilizationPercentage"
| summarize avg(Val) by bin(TimeGenerated, 5m)

Update alerts, dashboards, and workbooks

  • Identify alert rules, dashboards, and workbooks that query the InsightsMetrics table.
  • Replace them with PromQL-based queries against the Azure Monitor workspace where needed.
  • Validate the updated artifacts before you stop logs-based collection.

Remove the logs-based DCR association

After you update dependencies, remove the logs-based DCR association to stop new logs-based metric collection and reduce Log Analytics ingestion costs. The logs-based DCR typically has a name such as MSVMI-<workspace-name>.

  1. In the Azure portal, go to Monitor > Data Collection Rules.
  2. Select the Resources tab.
  3. Find your VM.
  4. Select the number in the Data collection rules column.
  5. Identify the logs-based DCR. It typically has a name that starts with MSVMI-.
  6. Select the DCR, and then select Delete association.
  7. Confirm the deletion.

Rollback

If you need to resume the logs-based experience:

  1. Recreate the association between the VM and the logs-based DCR.
  2. Confirm that the expected InsightsMetrics data is flowing again.
  3. Remove the metrics-based DCR association if you no longer need it.

For more information about VM monitoring configuration, see Enable VM monitoring in Azure Monitor.

Remove the VM insights solution

After you remove the logs-based experience from all VMs that use the workspace, you can remove the VM insights solution from that Log Analytics workspace. Do this only when no VMs still depend on the logs-based experience.

For the steps, see Remove VM insights solution.