In an KQL Query, displaying Azure Function App Logs, that will be used in Grafana, we want to have an Variable "Show Host Status Messages" in Grafana.
If "$ShowHostStatus" == True, show all Messages. If "$ShowHostStatus" == False, show all Messages, but filter out all messages starting with "Host Status". (where Message !startswith "Host Status")
Would it be possible to use a Query similar to this, applying some inline filter for messages inside {Message_Filtered_For_Host_Status} ?
FunctionAppLogs
| where AppName == "$FunctionApp"
| extend Message = iff(("$ShowHostStatus" == "True"), Message, {Message_Filtered_For_Host_Status} )
| project TimeGenerated, FunctionName, Level, Message
I don't have access to a Granfa to test sorry, but would something like the following work?
PoC code with different variable name.