目前存在一个为Azure Resources linked here创建日志诊断设置的模块。使用门户,我能够为活动日志以及提到的here生成日志诊断设置。我试图启用活动日志诊断设置并将日志发送到存储帐户,但只遇到了此module。
但是,似乎无法使用此模块将活动日志发送到日志分析工作区。也不支持门户中提到的日志类别(即Administrative、Security、ServiceHealth等),仅提供Action、Delete和Write。这让我相信它们不是为了同样的目的而使用的。第一个模块需要一个target_resource_id,因为活动日志存在于订阅级别,所以不存在这样的id。
因此,是否可以使用前面提到的模块或完全不同的模块来启用诊断设置?如能就此事提供任何帮助,将不胜感激。
发布于 2021-05-11 10:32:57
您可以通过将订阅id指定为azurerm_monitor_diagnostic_setting资源中的target_resource_id来进行配置。
示例:
resource "azurerm_monitor_diagnostic_setting" "example" {
name = "example"
target_resource_id = "/subscriptions/85306735-db49-41be-b899-b0fc48095b01"
eventhub_name = azurerm_eventhub.diagnostics.name
eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.diagnostics.id
log {
category = "Administrative"
retention_policy {
enabled = false
}
}https://stackoverflow.com/questions/67383089
复制相似问题