az monitor diagnostic-settings
管理服务诊断设置。
命令
az monitor diagnostic-settings create
为指定的资源创建诊断设置。 有关详细信息,请访问:https://learn.microsoft.com/rest/api/monitor/diagnosticsettings/createorupdate#metricsettings。
az monitor diagnostic-settings create --name
--resource
[--event-hub]
[--event-hub-rule]
[--export-to-resource-specific {0, 1, f, false, n, no, t, true, y, yes}]
[--logs]
[--marketplace-partner-id]
[--metrics]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
[--storage-account]
[--workspace]
示例
创建诊断设置,此处的保留期仅适用于目标是存储帐户。
az monitor diagnostic-settings create --resource {ID} -n {name} --storage-account {storageAccount} --logs "[{category:WorkflowRuntime,enabled:true,retention-policy:{enabled:false,days:0}}]" --metrics "[{category:WorkflowRuntime,enabled:true,retention-policy:{enabled:false,days:0}}]"
必需参数
诊断设置的名称。 Required.
目标资源的名称或 ID。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
为事件中心命名或 ID。 如果未指定任何事件,则会选择默认事件中心。
事件中心授权规则的名称或 ID。
指示必须对资源特定的表(即专用或固定架构表)执行到 LA 的导出,而不是名为 AzureDiagnostics 的默认动态架构表。 仅当参数 --workspace 也给定时,此参数才有效。 允许的值:false、true。
属性 | 值 |
---|---|
接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
日志设置的 JSON 编码列表。 使用“@{file}”从文件加载。有关详细信息,请访问:https://learn.microsoft.com/rest/api/monitor/diagnosticsettings/createorupdate#logsettings。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
要向其发送诊断日志的市场资源的完整 ARM 资源 ID。
指标设置列表。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源提供程序命名空间。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源父路径(如果适用)。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源类型。 还可以接受命名空间/类型格式(例如:“Microsoft.Compute/virtualMachines”。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
要向其发送诊断日志的存储帐户的名称或 ID。
要向其发送诊断日志的 Log Analytics 工作区的名称或 ID。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor diagnostic-settings delete
删除指定资源的现有诊断设置。
az monitor diagnostic-settings delete --name
--resource
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
必需参数
诊断设置的名称。 Required.
目标资源的名称或 ID。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源提供程序命名空间。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源父路径(如果适用)。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源类型。 还可以接受命名空间/类型格式(例如:“Microsoft.Compute/virtualMachines”。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor diagnostic-settings list
获取指定资源的活动诊断设置列表。
az monitor diagnostic-settings list --resource
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
必需参数
目标资源的名称或 ID。
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
目标资源提供程序命名空间。
目标资源父路径(如果适用)。
目标资源类型。 还可以接受命名空间/类型格式(例如:“Microsoft.Compute/virtualMachines”。
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor diagnostic-settings show
获取指定资源的活动诊断设置。
az monitor diagnostic-settings show --name
--resource
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
必需参数
诊断设置的名称。 Required.
目标资源的名称或 ID。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源提供程序命名空间。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源父路径(如果适用)。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源类型。 还可以接受命名空间/类型格式(例如:“Microsoft.Compute/virtualMachines”。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |
az monitor diagnostic-settings update
更新指定资源的诊断设置。
az monitor diagnostic-settings update --name
--resource
[--add]
[--event-hub]
[--event-hub-rule]
[--force-string {0, 1, f, false, n, no, t, true, y, yes}]
[--log-ana-dtype --log-analytics-destination-type]
[--logs]
[--marketplace-partner-id]
[--metrics]
[--remove]
[--resource-group]
[--resource-namespace]
[--resource-parent]
[--resource-type]
[--service-bus-rule-id]
[--set]
[--storage-account-id]
[--workspace-id]
必需参数
诊断设置的名称。 Required.
目标资源的名称或 ID。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
可选参数
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>
。
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
事件中心的名称。 如果未指定任何事件,则会选择默认事件中心。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
事件中心授权规则的资源 ID。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
接受的值: | 0, 1, f, false, n, no, t, true, y, yes |
一个字符串,指示导出到 Log Analytics 是否应使用默认目标类型,即 AzureDiagnostics,或使用构造的目标类型,如下所示:<normalized service identity>_<normalized category name>
。 可能的值为:专用值和 null(默认值为 null)。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
日志设置的列表。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
要向其发送诊断日志的市场资源的完整 ARM 资源 ID。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
指标设置列表。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
从列表中删除属性或元素。 示例: --remove property.list <indexToRemove>
OR --remove propertyToRemove
.
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
资源组的名称。 可以使用 az configure --defaults group=<name>
配置默认组。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源提供程序命名空间。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源父路径(如果适用)。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
目标资源类型。 还可以接受命名空间/类型格式(例如:“Microsoft.Compute/virtualMachines”。
属性 | 值 |
---|---|
Parameter group: | Target Resource Arguments |
诊断设置的服务总线规则 ID。 这是为了保持向后兼容性。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>
。
属性 | 值 |
---|---|
Parameter group: | Generic Update Arguments |
要向其发送诊断日志的存储帐户的资源 ID。
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
要向其发送诊断日志的 Log Analytics 工作区的完整 ARM 资源 ID。 Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2.
属性 | 值 |
---|---|
Parameter group: | Properties Arguments |
全局参数
提高日志记录详细程度以显示所有调试日志。
属性 | 值 |
---|---|
默认值: | False |
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
属性 | 值 |
---|---|
默认值: | False |
Output format.
属性 | 值 |
---|---|
默认值: | json |
接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。
属性 | 值 |
---|---|
默认值: | False |