0
votes

This may be a simple question but I find the Azure documentation vast and a bit vague to advice would be appreciated.

So I've got docker container running in Azure app service. I have a linux container which is pushed to Azure container registry from our pipelines where it is then used by the web app. I can view the log stream which automatically displays the docker logs and I assume anything sent to standard out.

There are various logs files within the container on certain file paths. How can I access these logs? (Other than using ssh in Kudu to get into the container). Is there a way of mapping these file paths to one of the Azure log analytic tools?

Thanks - Please let me know if you need more information on any part of this setup.

2

2 Answers

1
votes

There are two ways of managing log files in container.

Docker best practices will ask that ALL logs be redirected to the STDOUT. This allow commands like docker logs or az webapp log.

Note that there is a request to have to log files stores to a storage account: https://github.com/Azure/azure-cli/issues/10043

Also, what you could do, would be to mount a folder in your web app container into a storage account and ensure that those internal log files are store on the storage account: https://docs.microsoft.com/en-us/cli/azure/webapp/config/storage-account?view=azure-cli-latest#az-webapp-config-storage-account-add

https://docs.microsoft.com/en-us/azure/app-service/containers/how-to-serve-content-from-azure-storage

this would allow you to expose a storage account for your container

1
votes

Sending arbitrary file logs to log analytics from Azure App Service is not natively supported.

You could try setting up your container with the Log Analytics Agent which allows you to configure a custom logs data source, as long as your file has a compliant format.