Quick Guide for Datadog Agent on Docker for Logs
-
Use the official Datadog Agent image with Docker’s environment variables to ensure that you collect all logs from the containers.
docker run -d --name datadog-agent -e DD_API_KEY=kloudfuse -e DD_SITE=https://<kf-domain-name>/ingester -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true -e DD_LOGS_ENABLED=true -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true -e DD_APM_ENABLED=true -e DD_DD_URL=https://<kf-domain-name>/ingester --volume /var/run/docker.sock:/var/run/docker.sock:ro --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /host:/host:ro --name datadog-agent datadog/agent:latest -
Expose Docker container logs through its Docker Logs system, and run the Docker Agent with log forwarding configuration:
docker run -d --name nginx -v /path/to/nginx/logs:/var/log/nginx nginx -
To collect logs for additional services, such as Nginex, mount its log directory.