Collecting Docker logs
In Chapter 2, Deploying the Datadog Agent, you learned how to monitor Docker-based containers as part of the infrastructure. By configuring the Datadog Agent appropriately, information about the running Docker containers, the
metrics.* group of metrics, can be obtained and the health of containers can be monitored. The application logs from a container are typically written to the
stderr streams. In this section, let's look at how application logs can be collected by configuring the Datadog Agent and the corresponding Docker image.
The preferred method to collect logs from a container is to run the Datadog Agent as a container on the same Docker host. Though the actual command line to start the Datadog Agent container can be slightly different depending on the target operating system, on a Unix-like system such as macOS or Linux it would be as follows:
$ docker run -d --name datadog-agent \ ...