you should be able to use the parse
operator: https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/parseoperator
for example:
print input = 'event=1921;json={"source":"A","location":B":"folder":"c:\windows\system32"},"id":2,"address":null,"name":"gone";'
| parse input with * "json=" json:dynamic ',"id"' * '"name":"' name '"' *
if your payload / property names are entirely dynamic, then:
a. I would recommend you evaluate your options to structure the source data in standard format (currently, even the "json
" part of it isn't valid JSON)
b. you could try the following - functional, but very inefficient (not recommended for large scale data procesing)
datatable(input:string)
[
'event=1921;json={"source":"A","location":B":"folder":"c:\windows\system32"},"id":2,"address":null,"name":"gone";',
'dev=b;json={"dest":"123","home":AZ":"loc":"sys"},"ab":9,"home":null,"someKey":"someValue";'
]
| parse input with prefix ";json={" json:dynamic '},' suffix
| mv-apply x = extract_all(@'(w+)=(w+)', prefix) on (
project p = pack(tostring(x[0]), x[1])
| summarize b1 = make_bag(p)
)
| mv-apply y = extract_all(@'"(w+)":"?(w+)"?', suffix) on (
project p = pack(tostring(y[0]), y[1])
| summarize b2 = make_bag(p)
)
| project json = strcat("{", json, "}"), b = bag_merge(b1, b2)
| evaluate bag_unpack(b)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…