查询1:
traces
| where customDimensions.Domain == "someDomain"
| where message contains "some-text"
| project itemId=substring(itemId,indexof(itemId,"-"),strlen(itemId))结果:
itemId
-C 580-11e9-888A-8776d3f65945 -C 580-11e9-888A-8776d3f65945 -c 580-11e9-9b01-c3be0f4a2bf2
查询2:
traces
| where customDimensions.Domain == "someDomain"
| where itemId has toscalar(
traces
| where customDimensions.Domain == "someDomain"
| where message contains "some-text"
| project itemId=substring(itemId,indexof(itemId,"-"),strlen(itemId)))第二个查询的结果返回只匹配子查询的最后一个记录的记录。
ie:) >-c 580-11e9-9b01-c3be0f4a2bf2
问题:
如何获得与所有三项匹配的整个结果集。
我的要求是为特定请求获取完整的日志序列。
为了获得下面的输入,我可以获取一个日志,从中可以找到ItemId
itemId看起来像"b5066283-c7ea-11e9-9e9b-2ff40863cba4"。与此请求相关的所有日志的其余部分必须具有"-c7ea-11e9-9e9b-2ff40863cba4"这个值。只有第一部分才会像b5066284、b5066285、b5066286那样递增。
发布于 2019-08-26 15:23:42
顾名思义,toscalar()返回一个标量值。
给定带有N列和M行的表格参数,它将返回第1列和第1行中的值。
例如:下面将返回一个值- 1
let T = datatable(a:int, b:int, c:int)
[
1,2,3,
4,5,6,
7,8,9,
]
;
print toscalar(T)如果我正确理解第二个查询的意图,您应该能够通过使用has_any实现您的需求。
例如
let T = datatable(item_id:string)
[
"c580-11e9-888a-8776d3f65945",
"c580-11e9-888a-8776d3f65945",
"c580-11e9-9b01-c3be0f4a2bf2",
]
;
T
| where item_id has_any (
(
T
| parse item_id with * "-" item_id
)
)https://stackoverflow.com/questions/57653898
复制相似问题