首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用带通配符的括号进行Kusto查询

使用带通配符的括号进行Kusto查询
EN

Stack Overflow用户
提问于 2022-11-30 14:42:14
回答 1查看 32关注 0票数 0

您能帮我识别我需要使用哪种类型的通配符才能在我的属性字段中找到特定的电子邮件地址吗?

我知道我正在寻找的电子邮件是在插槽号码2,我怎么能找到电子邮件地址,而不知道插槽号码?我能用*代替2吗?

以下是我的查询:

代码语言:javascript
运行
复制
resources
| where type == 'microsoft.insights/actiongroups'
| where properties["enabled"] in~ ('true')
| where properties['emailReceivers'][2]['emailAddress'] == "DevSecOps@pato.com"
| project id,name,resourceGroup,subscriptionId,properties,location
| order by tolower(tostring(name)) asc

我的属性字段中有以下数据:

代码语言:javascript
运行
复制
{
    "enabled": true,
    "automationRunbookReceivers": [],
    "azureFunctionReceivers": [],
    "azureAppPushReceivers": [],
    "logicAppReceivers": [],
    "eventHubReceivers": [],
    "webhookReceivers": [],
    "armRoleReceivers": [],
    "emailReceivers": [
        {
            "name": "TED",
            "status": "Enabled",
            "useCommonAlertSchema": true,
            "emailAddress": "tedtechnicalengineeringdesign@pato.com"
        },
        {
            "name": "SevenOfNine",
            "status": "Enabled",
            "useCommonAlertSchema": true,
            "emailAddress": "sevenofnine@pato.com"
        },
        {
            "name": "PEAT",
            "status": "Enabled",
            "useCommonAlertSchema": true,
            "emailAddress": "DevSecOps@pato.com"
        }
    ],
    "voiceReceivers": [],
    "groupShortName": "eng-mon",
    "itsmReceivers": [],
    "smsReceivers": []
}

我试过使用*而不是2,但它没有起作用。

EN

回答 1

Stack Overflow用户

发布于 2022-11-30 18:13:26

我找到了一种使用关键字"contains“来实现它的方法。

这样您就不需要指定它应该在哪个槽中找到它,它可能是,1,2.n

代码语言:javascript
运行
复制
resources
| where type == 'microsoft.insights/actiongroups'
| where properties["enabled"] in~ ('true')
| where properties['emailReceivers'] contains "DevSecOps@pato.com"
| project id,name,resourceGroup,subscriptionId,properties,location
| order by tolower(tostring(name)) asc
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74629613

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档