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...
davidwhitenz
Mar 01, 2021Copper Contributor
Have had similar issues 🙂
You can either use the query feature, there are some examples here albeit a bit tricky to get the syntax right:
https://docs.microsoft.com/en-us/cli/azure/query-azure-cli
Be mindful of the comment about potentially having to escape and wrapping also.
Otherwise an alternative is to pipe the output to another process and filter from there.
az webapp log tail --name some-demo-app --resource-group some-demo-rg | grep -ie 'value1' -ie 'value2'
grep or similar depending on where it is being run from.
You can either use the query feature, there are some examples here albeit a bit tricky to get the syntax right:
https://docs.microsoft.com/en-us/cli/azure/query-azure-cli
Be mindful of the comment about potentially having to escape and wrapping also.
Otherwise an alternative is to pipe the output to another process and filter from there.
az webapp log tail --name some-demo-app --resource-group some-demo-rg | grep -ie 'value1' -ie 'value2'
grep or similar depending on where it is being run from.