Migrate from Log Analytics agent custom log table to Azure Monitor Agent DCR-based custom log table

This article explains how to migrate a custom text log table from the legacy Log Analytics agent (MMA) so you can use it as the destination for custom text logs that Azure Monitor Agent (AMA) collects through a data collection rule (DCR).

Background

You must configure Log Analytics agent custom text logs to support new DCR features that let AMA write to the table. Consider the following points:

  • The table is reconfigured to enable all features for DCR-based custom logs.
  • AMA can write data to any column in the table.
  • Log Analytics agent custom text logs can no longer write to that table.

To keep writing your custom data from both the Log Analytics agent and AMA, each agent needs its own custom log table. Your data queries in Log Analytics must join the two tables until the migration is complete, at which point you can remove the join.

Migration

You should follow the steps only if the following criteria are met:

  • You created the original table using the Custom Log Wizard.
  • You want to preserve the existing data in the table.
  • You don't need Log Analytics agents to send data to the existing table.
  • You want to exclusively write new data by using a DCR for AMA custom text logs and possibly configure an ingestion time transformation.

Prerequisites

For Azure CLI or Azure PowerShell, select the subscription that contains your Log Analytics workspace before you run the migration command.

Procedure

  1. Configure your data collection rule (DCR) by following the instructions in collect text logs with AMA.

  2. To enable ingestion from a DCR and manage your table in the Azure portal, issue the following API call against your existing custom log table. This call only changes the table the first time you run it. Running it again has no effect. Migration is one-way, so you can't migrate the table back to the Log Analytics agent.

    The following Azure CLI example uses the az monitor log-analytics workspace table migrate command.

    # Set variables
    resourceGroupName="<ResourceGroupName>"
    workspaceName="<WorkspaceName>"
    tableName="<TableName>_CL"
    
    # Migrate the custom log table
    az monitor log-analytics workspace table migrate --resource-group "$resourceGroupName" \
      --workspace-name "$workspaceName" \
      --table-name "$tableName"
    

    Note

    Azure CLI commands use the Azure Resource Manager endpoint from the current CLI context, so management.chinacloudapi.cn doesn't need to be specified in the command syntax.

  3. Discontinue the Log Analytics agent custom text logs collection and start using AMA custom text logs.

Next steps