简体   繁体   English

使用ARM模板成功创建了Azure日志警报规则,但未出现在门户中

[英]Azure log alert rule created successfully with ARM template but not appearing in portal

I have created a few ARM templates for deploying Azure metric alert rules, but I now have a requirement to deploy a log alert rule (ie a rule based on an Application Insights query rather than a platform metric). 我已经创建了一些用于部署Azure指标警报规则的ARM模板,但是现在我需要部署日志警报规则(即基于Application Insights查询而不是平台指标的规则)。

I have scripted the template following the example here (which suggests I need to create a resource of type Microsoft.Insights/scheduledQueryRules ) and deployed using Azure portal's Template Deployment service as described here . 我已经按照此处示例编写了模板脚本(这表明我需要创建Microsoft.Insights/scheduledQueryRules类型的资源),并使用Azure门户的模板部署服务进行部署,如下所述

Azure reports the deployment as successful, and the activity log gives me the deployment result, including the ID of my new resource eg /subscriptions/[subscription-id]/resourcegroups/[alerts-resource-group]/providers/Microsoft.Insights/scheduledQueryRules/Custom errors spike alert . Azure将部署报告为成功,活动日志为我提供了部署结果,包括我的新资源的ID,例如/subscriptions/[subscription-id]/resourcegroups/[alerts-resource-group]/providers/Microsoft.Insights/scheduledQueryRules/Custom errors spike alert

However, when I navigate to the Monitor blade in subscription [subscription-id], and filter down by resource group [alerts-resource-group] I don't see my new alert. 但是,当我导航到订阅[subscription-id]中的Monitor刀片并按资源组[alerts-resource-group]进行过滤时,看不到新警报。

As a sanity check I created a metric alert using the same process targeting the same App Insights resource, and this one does show up in the Monitor blade. 作为健全性检查,我使用针对相同App Insights资源的相同过程创建了一个指标警报,并且该警报确实显示在Monitor刀片服务器中。

I guess my question is, am I misunderstanding something about log-based alert rules? 我想我的问题是,我是否误解了基于日志的警报规则? For example, does an Azure 'resource' of type Microsoft.Insights/scheduledQueryRules equate with alert rules of signal type Log Search in Monitor / Alerts / Manage alert rules ? 例如, Microsoft.Insights/scheduledQueryRules类型的Azure“资源”是否等于“ 监视器/警报/管理警报规则”中信号类型为“ 日志搜索”的 警报规则 I'm confident my template is correct because it passes validation and completed successfully. 我确信我的模板是正确的,因为它通过了验证并成功完成了。 But I'm baffled about where the alert rule is ending up! 但是我对警报规则在哪里结束感到困惑!

One thing I should mention is that I'm creating the alert rule in a different resource group to the App Insights instance itself, but this is also true of the metric alert so assumed this wasn't significant. 我应该提到的一件事是,我将在与App Insights实例本身不同的资源组中创建警报规则,但是对于度量标准警报也是如此,因此假设这并不重要。

It turns out log alerts require a hidden link to the resource they're monitoring. 事实证明,日志警报需要隐藏链接到他们正在监视的资源。 Otherwise they get created but not listed anywhere in the portal. 否则,它们将被创建,但不会在门户中的任何位置列出。

In my case I added the following variable to the template: 就我而言,我在模板中添加了以下变量:

"linkToAiResource" : "[concat('hidden-link:', resourceId('microsoft.insights/components', parameters('appInsightsResourceName')))]"

Then included this as a tag in the resource definition like this: 然后将其作为标签包含在资源定义中,如下所示:

"tags": {
    "[variables('linkToAiResource')]": "Resource"
}

Once redeployed the alert rule appears in the portal's Monitor blade. 重新部署后,警报规则将出现在门户网站的“监视”刀片中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ARM模板中的Azure Application Insights警报规则 - Azure Application Insights Alert Rule in ARM Template Azure:使用 ARM 模板部署日志警报失败 - Azure: Failed log alert deployment with ARM template 如何在 ARM 模板中引用在 Azure 门户中创建的现有存储帐户 - How to reference an existing storage account created in Azure portal in an ARM template 使用 Terraform(或 ARM 模板)为 Web 测试创建 Azure 警报规则? - Creating an Azure Alert Rule for a Webtest with Terraform (or ARM template)? Web测试中未启用Azure ARM模板中的警报规则 - Alert rule in Azure ARM template not enabled in web test Azure 日志分析。 使用 ARM 模板创建警报规则 - Azure Log Analytics. Create Alert Rules with ARM Template Azure Portal ARM 模板导出中不包含诊断设置 - Diagnostic setting not included in Azure Portal ARM template export Azure Log Analytics 数据收集器的 ARM 模板 - ARM template for Azure Log Analytics Data Collector Azure ARM模板 - 访问由另一个ARM模板中的一个ARM模板创建的资源ID - Azure ARM Template - accessing a resource Id created by one ARM template in another ARM template ARM 模板:没有为数据库服务器创建防火墙规则 - ARM Template: Firewall rule is not being created for database server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM