Log Monitoring in Docker

Dynatrace log monitoring supports the collection of logs from non-orchestrated Docker environments via OneAgent. To learn more about log monitoring in orchestrated platforms, such as Kubernetes and OpenShift, that use Docker as the Container Runtime Interface (CRI), see Log Monitoring in Kubernetes.

How autodiscovery works

OneAgent autodiscovers log messages written to the containerized application's stdout/stderr streams. The Docker logging driver saves these log streams in a file located in the /var/lib/docker/containers directory on the host running the containers. OneAgent autodiscovers log files from that path.

OneAgent does not discover logs written directly to the container's file system.

Autodiscovery requirements

Requirements for autodiscovery of Docker logs:

  • The process running in the container is an important process.
  • The container uses a json-file logging driver.
  • Logs are written to the container's stdout/stderr streams.
  • The log file in /var/lib/docker/containers exists for a minimum of one minute after container execution is finished.

Connecting logs with Docker properties and annotations

As OneAgent discovers logs from the /var/lib/docker/containers path on a host running in a non-orchestrated Docker environment, it connects specific logs to a corresponding container based on the container ID from the file path.

In addition, OneAgent enhances these logs with the following Docker metadata:

  • container.name
  • container.id
  • container.image.name