Azure Diagnostic Settings “category Group” argument is not available

resource "azurerm_logic_app_workflow" "workflow" {
  name                = "test-secops-workflow"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
}

resource "azurerm_monitor_diagnostic_setting" "logicapp" {
  name               = "Logs to Central Storage account"
  target_resource_id = azurerm_logic_app_workflow.workflow.id
  storage_account_id = azurerm_storage_account.storagesecops.id

  log {
    category = "allLogs"
    enabled  = true

    retention_policy {
      enabled = true
    }
  }

}

Above code fails, diagnostic settings does not support category group. Below is the error:

insights.DiagnosticSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 – Original Error: autorest/azure: Service returned an error. Status=400 Code=“BadRequest” Message="Category ‘allLogs’ is not supported.

1 Like

@hcrhall Could you please help me out here?

It looks like you are using the wrong category for the azurerm_logic_app_workflow resource. You can determine which categories are supported by using the azurerm_monitor_diagnostic_categories data source.

Hope this helps.

@hcrhall , I have attached a screenshot of allowed log categories and metrics. In my case I want to enable the log category groups “allLogs” and like we have argument for “categories”, I cannot find argument for “category groups” in terraform resource.
Hope I am clear.

Screenshot 2022-07-05 215130

Reading the docs, it appears that choosing the WorkflowRuntime is the same as choosing allLogs.

My understanding is that allLogs is a shortcut for selecting each of the available categories. Since there is only one category available, you can simply change the configuration to the following:

resource "azurerm_monitor_diagnostic_setting" "logicapp" {
  name               = "Logs to Central Storage account"
  target_resource_id = azurerm_logic_app_workflow.workflow.id
  storage_account_id = azurerm_storage_account.storagesecops.id

  log {
    category = "WorkflowRuntime"
    enabled  = true

    retention_policy {
      enabled = true
    }
  }