My website uses a docker container, and I host it on Azure using an Azure App Service. I use a Seq log server to centralize logging.
How can I send the Docker container logs from my Azure App Service to my Seq log server?
I am afraid that the answer might be that this is impossible. The "proper" way to send Docker container logs to a Seq log server includes adding some arguments to the docker run
command, but I can't find any way to provide such arguments in the Azure App Service or the corresponding Azure Web App Service for Container task that I use to deploy a new container image to that service.
One reason I want the docker logs sent to Seq is that I think the handling of logs by Azure is confusing. This question contains many answers about how one might claw some docker logs out of Azure, but none would be as simple or complete as searching for "docker" in a Seq log server.
Maybe Azure App Service isn't the correct tool for the job. Instead, maybe I should be using Azure Container Instance (ACI). The integration with Docker seems strong. However, this answer says
Azure Web App for Containers is targeted at long running stuff (always running) while ACI are aimed at scheduled\burstable\short lived workloads (similar to Azure Functions).
My website should always be running, so this makes me think that I am correctly using Azure App Service.
Maybe I should deploy to my Azure App Service using the Docker task. However, two things make me think otherwise. The first is that the task says:
[...]
Also, my Azure App Service includes many arguments when it executes docker run
. I don't know what they all do, and don't know what I would need to include to make things work correctly.
Maybe these options that are configurable via arguments to docker run
can be hardcoded with a Docker image when it is created. However, I haven't found any suggestion that this is possible.
One of the arguments to docker run
that I care about is --log-driver
. The default log driver for a Docker container can be set via the daemon.json
configuration file. Maybe the Docker container associated with my Azure App Service can be configured via this configuration file. However, I haven't found any way to do this.