I need to create a query to find logs where I can see requests and traces together and analyse if User SQL input queries are wrong?
I could not find schéma over logs tables and how to join them ?
How I can do it ?
Simple query in Application Insight logs analytics
2
Answers
the solution was :
exceptions | project exceptionTimestamp = timestamp, operation_Id, operation_Name, outerMessage, exceptionCorrelationId = tostring(parse_json(customDimensions).correlationId), details | join ( traces | project traceTimestamp = timestamp, operation_Id, message, traceCorrelationId = tostring(parse_json(customDimensions).correlationId) ) on $left.exceptionCorrelationId == $right.traceCorrelationId | project exceptionCorrelationId, traceCorrelationId, traceTimestamp, exceptionTimestamp, operation_Name, message, outerMessage, details | where outerMessage contains "Execution Timeout Expired" and message contains "Executing query:" | order by exceptionTimestamp desc
Usually, depending on your app, you can do that by using e.g. the
operation_Id
: