使用 azure cli 自动创建资源的诊断设置
Using the azure cli to automate the creation of Diagnostic Settings for resources
方法:
az monitor diagnostic-settings create --resource $resourceId -n $name --event-hub $eventHub --logs '[ { "category": "WorkflowRuntime", "enabled": true, "retentionPolicy": { "enabled": false, "days": 0 } } ]' --metrics '[ { "category": "WorkflowRuntime", "enabled": true, "retentionPolicy": { "enabled": false, "days": 0 } } ]
预期
为由 resourceId 标识的指定资源创建诊断设置
实际
(BadRequest) Metric category 'WorkflowRuntime' is not supported, supported categories are: 'Capacity;Transaction'.
对这个问题的任何帮助都会很棒。谢谢。
根据错误,资源没有日志类别。实际上,不同的资源类型有不同的日志类别。详情请参考here。
如果你想获取一个资源的可用类别,你可以使用下面的命令
az monitor diagnostic-settings categories list --resource <resource id>
方法:
az monitor diagnostic-settings create --resource $resourceId -n $name --event-hub $eventHub --logs '[ { "category": "WorkflowRuntime", "enabled": true, "retentionPolicy": { "enabled": false, "days": 0 } } ]' --metrics '[ { "category": "WorkflowRuntime", "enabled": true, "retentionPolicy": { "enabled": false, "days": 0 } } ]
预期
为由 resourceId 标识的指定资源创建诊断设置
实际
(BadRequest) Metric category 'WorkflowRuntime' is not supported, supported categories are: 'Capacity;Transaction'.
对这个问题的任何帮助都会很棒。谢谢。
根据错误,资源没有日志类别。实际上,不同的资源类型有不同的日志类别。详情请参考here。
如果你想获取一个资源的可用类别,你可以使用下面的命令
az monitor diagnostic-settings categories list --resource <resource id>