@@ -21,6 +21,9 @@ version: "3"
2121services :
2222 web :
2323 build : web
24+ # Uncomment to enable log collection for the web container
25+ # labels:
26+ # com.datadoghq.ad.logs: '[{"source": "web"}]'
2427 command : python app.py
2528 ports :
2629 - " 5000:5000"
@@ -32,20 +35,36 @@ services:
3235 - DATADOG_HOST=datadog # used by the web app to initialize the Datadog library
3336 redis :
3437 image : redis
38+ # Uncomment to enable log collection for the redis container
39+ # labels:
40+ # com.datadoghq.ad.logs: '[{"source": "redis"}]'
3541 # agent section
3642 datadog :
3743 build : datadog
44+ # Uncomment to enable log collection for the agent container
45+ # labels:
46+ # com.datadoghq.ad.logs: '[{"source": "redis"}]'
3847 links :
3948 - redis # ensures that redis is a host that the container can find
4049 - web # ensures that the web app can send metrics
4150 environment :
4251 - DD_API_KEY=__your_datadog_api_key_here__
52+ - DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
53+ # Uncomment to enable the log collection feature
54+ # - DD_LOGS_ENABLED=true
55+ # - DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true
4356 volumes :
4457 - /var/run/docker.sock:/var/run/docker.sock
4558 - /proc/:/host/proc/:ro
4659 - /sys/fs/cgroup:/host/sys/fs/cgroup:ro
60+ # Uncomment to enable the log collection feature
61+ # - /var/lib/docker/containers:/var/lib/docker/containers:ro
4762```
4863
64+ The Datadog Agent can also optionnaly collect logs from any container, if you
65+ want to do so just uncomment the relevant lines from the ` docker-compose.yml `
66+ file.
67+
4968# Configuring the Agent
5069
5170Because the Agent needs to monitor redis it needs:
@@ -75,4 +94,4 @@ How to test this?
75941. Clone this repository
76951. Update your ` DD_API_KEY` in `docker-compose.yml`
77961. Run all containers with `docker-compose up`
78- 1 . Verify in Datadog that your container picks up the docker and redis metrics
97+ 1. Verify in Datadog that your container picks up the docker and redis metrics
0 commit comments