diff --git a/README.md b/README.md index f04a83e..068cc01 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ version: "3" services: web: build: web + # Uncomment to enable log collection for the web container + # labels: + # com.datadoghq.ad.logs: '[{"source": "web"}]' command: python app.py ports: - "5000:5000" @@ -32,20 +35,36 @@ services: - DATADOG_HOST=datadog # used by the web app to initialize the Datadog library redis: image: redis + # Uncomment to enable log collection for the redis container + # labels: + # com.datadoghq.ad.logs: '[{"source": "redis"}]' # agent section datadog: build: datadog + # Uncomment to enable log collection for the agent container + # labels: + # com.datadoghq.ad.logs: '[{"source": "redis"}]' links: - redis # ensures that redis is a host that the container can find - web # ensures that the web app can send metrics environment: - DD_API_KEY=__your_datadog_api_key_here__ + - DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true + # Uncomment to enable the log collection feature + # - DD_LOGS_ENABLED=true + # - DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true volumes: - /var/run/docker.sock:/var/run/docker.sock - /proc/:/host/proc/:ro - /sys/fs/cgroup:/host/sys/fs/cgroup:ro + # Uncomment to enable the log collection feature + # - /var/lib/docker/containers:/var/lib/docker/containers:ro ``` +The Datadog Agent can also optionnaly collect logs from any container, if you +want to do so just uncomment the relevant lines from the `docker-compose.yml` +file. + # Configuring the Agent Because the Agent needs to monitor redis it needs: @@ -75,4 +94,4 @@ How to test this? 1. Clone this repository 1. Update your `DD_API_KEY` in `docker-compose.yml` 1. Run all containers with `docker-compose up` -1. Verify in Datadog that your container picks up the docker and redis metrics \ No newline at end of file +1. Verify in Datadog that your container picks up the docker and redis metrics diff --git a/datadog/Dockerfile b/datadog/Dockerfile index e5e8968..4f4de05 100644 --- a/datadog/Dockerfile +++ b/datadog/Dockerfile @@ -1,2 +1,2 @@ -FROM datadog/agent:latest +FROM gcr.io/datadoghq/agent:latest ADD conf.d/redisdb.yaml /etc/datadog-agent/conf.d/redisdb.yaml diff --git a/docker-compose.yml b/docker-compose.yml index 1f99d1a..bb6ef27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,9 @@ version: "3" services: web: build: web + # Uncomment to enable log collection for the web container + # labels: + # com.datadoghq.ad.logs: '[{"source": "web"}]' command: python app.py ports: - "5000:5000" @@ -13,16 +16,27 @@ services: - DATADOG_HOST=datadog # used by the web app to initialize the Datadog library redis: image: redis + # Uncomment to enable log collection for the redis container + # labels: + # com.datadoghq.ad.logs: '[{"source": "redis"}]' # agent section datadog: build: datadog + # Uncomment to enable log collection for the agent container + # labels: + # com.datadoghq.ad.logs: '[{"source": "redis"}]' links: - redis # ensures that redis is a host that the container can find - web # ensures that the web app can send metrics environment: - DD_API_KEY=__your_datadog_api_key_here__ - DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true + # Uncomment to enable the log collection feature + # - DD_LOGS_ENABLED=true + # - DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true volumes: - /var/run/docker.sock:/var/run/docker.sock - /proc/:/host/proc/:ro - /sys/fs/cgroup:/host/sys/fs/cgroup:ro + # Uncomment to enable the log collection feature + # - /var/lib/docker/containers:/var/lib/docker/containers:ro