所以我有这样的Kusto查询
exceptions
| extend A_= tostring(customDimensions.A)
| where A_ in~ ("Could not get notes: From:", "failed to call", "Custom conference list" )
// | where A_ contains 'Could not get notes: From:' //This is working when I use "contains" operator but fails to check below 2 items when the first item doesn't exist
// | where A_ contains 'Custom conference list'
// | where A_ contains 'failed to call'
列表中的第一项是“无法获取注释:发件人:”,其中在字符串末尾具有多个ID
例如;
无法获取注释:来自:abcd
无法获取注释:来自:abcdef
我想做的是把所有以“无法获取笔记:发件人:”开头的项目放在“ in〜”运算符中。
到目前为止,我已经尝试使用如下的contains运算符
|where A_ contains 'Could not get notes: From:' // This seems to be working as it will outputting every item that starts with "Could not get notes: From:" but when I am trying to use it in the "in~" it is failing.
对于每个唯一项目使用“包含”运算符的问题是,如果其中任何项目(假设3个项目)都不存在,即使2个项目仍然存在,查询也不会返回结果。
不知道这是否有更好的解决方案。
您应该has_any
改用:
exceptions
| extend A_= tostring(customDimensions.A)
| where A_ has_any ("Could not get notes: From:", "failed to call", "Custom conference list")
另外,请注意,contains
它比has
/慢得多has_any
,因为后者使用索引仅获取相关记录,同时contains
扫描所有记录。但是请注意,两者之间在语义上有所不同:contains
查找子字符串,而has
仅查找完整标记。例如,"hello world" contains "hell"
将返回true
,而"hello world" has "hell"
将返回false
。在字符串运算符文档中查看更多信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句