0

I have the following query in Application Insights where I run the parsejson function multiple times in the same query.

Is it possible to reuse the data from the parsejson() function after the first invocation? Right now I call it three times in the query. I am trying to see if calling it just once might be more efficient.

EventLogs
| where Timestamp > ago(1h)  
        and tostring(parsejson(tostring(Data.JsonLog)).LogId) =~ '567890'
|   project Timestamp, 
    fileSize = toint(parsejson(tostring(Data.JsonLog)).fileSize),  
    pageCount = tostring(parsejson(tostring(Data.JsonLog)).pageCount)
| limit 10
4

1 回答 1

1

您可以extend为此使用:

EventLogs
| where Timestamp > ago(1h)
| extend JsonLog = parsejson(tostring(Data.JsonLog)
| where tostring(JsonLog.LogId) =~ '567890'
|   project Timestamp, 
    fileSize = toint(JsonLog.fileSize),  
    pageCount = tostring(JsonLog.pageCount)
| limit 10
于 2017-07-27T03:48:57.540 回答