Forum Discussion
Antti_Kurenniemi
Mar 01, 2021Copper Contributor
Need help with --query parameter in Azure CLI
Hi all! We've used the Az CLI sometimes to view log streams from App Service web apps. This works ok-ish, like so: az webapp log tail --name some-demo-app --resource-group some-demo-rg But we'r...
Antti_Kurenniemi
Mar 02, 2021Copper Contributor
Thanks; I've used grep for this and it works fine, I was just wondering how to actually make use of JMESHPath - it has the "contains" function which should do the trick, but as the correct syntax is "contains(string, substring)" - I have no idea what to put in the "string" part. i.e. how to refer to the output of the tail, when it doesn't seem to be JSON...
davidwhitenz
Mar 23, 2023Copper Contributor
JMESPath example to query a name object based on a location being a specified value:
az webapp list --query "[?location=='Australia East'].name"
Adjust as needed based on what you want to look for. You can also then grep on the end of that via a pipe of course and filter the results further. Alternatives are to use diag logs and kusto (which will have a time lag to write of 5-10 mins usually) or app insights live trace. All depends on what you are trying to view. Hopefully that helps.
az webapp list --query "[?location=='Australia East'].name"
Adjust as needed based on what you want to look for. You can also then grep on the end of that via a pipe of course and filter the results further. Alternatives are to use diag logs and kusto (which will have a time lag to write of 5-10 mins usually) or app insights live trace. All depends on what you are trying to view. Hopefully that helps.