我正在尝试为Azure中的存储帐户启用所有活动日志。这是代码块,这似乎是导致错误.
resource "azurerm_monitor_diagnostic_setting" "storage_account_logs" {
name = "storage-account-logs"
target_resource_id = azurerm_storage_account.example.id
storage_account_id = azurerm_storage_account.example.id
enabled_log {
category = "StorageRead"
retention_policy {
enabled = false
}
}
enabled_log {
category = "StorageWrite"
retention_policy {
enabled = false
}
}
enabled_log {
category = "StorageDelete"
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
当我为StorageRead、StorageWrite或StorageDelete添加enabled_logs时,代码会出错。下面是我得到的错误:
错误:更新资源"/subscriptions//resourceGroups//providers/Microsoft. Storage/storageAccounts/"的监视器诊断设置"storage-account-logs":diagnosticsettings. DiagnosticSettingsClient #CreateOrUpdate:未能响应请求:StatusCode = 400--原始错误:autorest/azure:服务返回错误。Status = 400 Code ="BadRequest" Message ="Category 'StorageRead' is not supported." │ │ with azurerm_monitor_diagnostic_setting. storage_account_logs,│
在www.example.com第42行,在资源“azurerm_monitor_diagnostic_setting”“storage_account_logs”中:main.tf line 42, in resource "azurerm_monitor_diagnostic_setting" "storage_account_logs": │ 42: resource "azurerm_monitor_diagnostic_setting" "storage_account_logs" {
2条答案
按热度按时间vawmfj5a1#
当我为StorageRead、StorageWrite或StorageDelete添加enabled_logs时,代码会出错。下面是我得到的错误:
我尝试使用
Terraform
启用存储帐户的诊断设置,但遇到了同样的错误。为了启用
StorageWrite,StorageRead and StorageDelete
在存储帐户诊断设置.基本上,您可以在storage account中的storage account类型的不同级别创建诊断设置。使用以下terraform代码启用存储帐户中的诊断设置。
一旦启用存储帐户的诊断设置,然后启用特定资源(如blob)的度量。
Terraform申请:
bsxbgnwa2#
如果我没有log_analytics_workspace,我将面临同样的问题。