Search code examples
azure-application-insightskql

Passing parameter to app() expression not working in application insights


I'm trying to pass a variable to the app() expression in application insights logs

  1. app('identifier').requests - works
  2. let e='identifier'; app(e).requests

Does not work with an error Query could not parse at 'app' on line [2,0]

Tried double quotes, escaping toscalar, tostring... Always the same result.

Thank you everybody


Solution

  • (I'm a part of Application Insights team)

    It is not possible (at least today). This limitation comes from this context:

    There is an engine which runs raw KQL queries against resources. The engine doesn't know anything about "app" keyword.

    There is something like preprocessor which analyzes a query and determines against which resources actually to run a query (and removes "app" from a query). This preprocessor cannot run KQL queries (at least today) and as a result it is not possible to use KQL to come up with dynamic resource identifiers.