应用程序见解:您可以将两个属性连接在一起吗?

问题描述

我有一个自定义事件,带有一个名为EventInfo的json(字符串)属性。有时,此属性将大于事件属性上设置的150个字符的限制,因此我必须将其拆分为多个属性,即EventInfo0,EventInfo1等。

例如(为简单起见已缩短) EventInfo0: [{ "label" : "likeButton","stat]EventInfo1: [us" : "success" }]

我发现了如何在诸如以下的应用程序见解中将EventInfo看做json:

customEvents
 | where name == "people"
 | extend Properties = todynamic(tostring(customDimensions.Properties))
 | extend type=parsejson(Properties.['EventInfo'])
 | mvexpand type
| project type,type.label,type.status]

有没有办法将EventInfo0和EventInfo1连接起来以创建完整的json字符串,并像上面那样查询

解决方法

根据文档,150个字符的限制在 key 上,而不是在整个有效负载上。因此,实际上可能不需要拆分。

https://docs.microsoft.com/en-us/azure/azure-monitor/app/data-model-event-telemetry#custom-properties

enter image description here

那是为了回答您的问题-虽然在查询时执行此操作效率低,但以下操作可能会起作用:

datatable(ei0:string,ei1:string)
[
    '[{ "label" : "likeButton","stat]','[us" : "success" }]','[{ "lab]','[el" : "bar","hello": "world" }]'
]
| project properties = parse_json(strcat(substring(ei0,1,strlen(ei0) - 2),substring(ei1,strlen(ei1) - 2)))
| project properties.label
properties_label
----------------
likeButton
bar

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...