How to fix "Data collection rule is invalid Multiple destinations for a stream 'Microsoft-AppServiceConsoleLogs"?

назар горщенко 0 Reputation points
2024-07-04T09:15:42.9766667+00:00

When i created the transformation manually via Azure portal all worked but when I created it via Terraform i had this error

Знімок екрана 2024-05-27 о 13.53.47

resource "azurerm_log_analytics_workspace" "logworkspace" {
  name                = "${var.resource_group_prefix}-${var.application_environment_name}${var.instance_name}-logs"
  location            = var.location
  resource_group_name = data.azurerm_resource_group.apprg.name
  sku                 = "PerGB2018"
  retention_in_days   = 30
  data_collection_rule_id = "/subscriptions/000000-00000--0000-0000/resourceGroups/test/providers/Microsoft.Insights/dataCollectionRules/test-dcr"
}



resource "azurerm_monitor_data_collection_rule" "backendlogs-dcr" {
  name                = "${var.resource_group_prefix}-${var.application_environment_name}-dcr"
  resource_group_name = data.azurerm_resource_group.apprg.name
  location            = var.location

  #kind = "WorkspaceTransforms"
  #kind  = "Linux"

  destinations {
    log_analytics {
      name = "${azurerm_log_analytics_workspace.logworkspace.name}"
      workspace_resource_id = azurerm_log_analytics_workspace.logworkspace.id
    }
  }


  data_flow {
    streams       = ["Microsoft-Table-AppServiceConsoleLogs"]
    #destinations  = ["example-destination-log"]
    destinations = ["${azurerm_log_analytics_workspace.logworkspace.name}"]
    output_stream = "Microsoft-AppServiceConsoleLogs"
    transform_kql = "source\n| extend Context = parse_json(ResultDescription)\n| extend Thread_CF = tostring(Context.thread)\n| extend Level_CF = tostring(Context.level)\n| extend Logger_CF = tostring(Context.logger)\n| extend Message_CF = tostring(Context.message)\n| project-away Context,ResultDescription"
    #"source\n| extend LL_CF = substring(ResultDescription, 12, 34)"
  }
Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,971 questions
0 comments No comments
{count} votes