AWS EB Multi-container Datadog integration not working properly

I have the following Dockerrun.aws.json:

{
    "AWSEBDockerrunVersion": 2,
    "containerDefinitions": [
        {
            "name": "dd-agent",
            "image": "gcr.io/datadoghq/agent:7.25.1",
            "environment": [
                {
                    "name": "DD_API_KEY",
                    "value": "xxxxx"
                },
                {
                    "name": "DD_ENV",
                    "value": "development"
                },
                {
                    "name": "DD_SERVICE",
                    "value": "xxxx"
                },
                {
                    "name": "DD_VERSION",
                    "value": "1.0.0"
                },
                {
                    "name": "DD_SITE",
                    "value": "datadoghq.com"
                },
                {
                    "name": "DD_TAGS",
                    "value": "app:xxxxx"
                },
                {
                    "name": "DD_LOGS_ENABLED",
                    "value": "true"
                },
                {
                    "name" : "DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL",
                    "value": "true"
                },
                {
                    "name" : "DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE",
                    "value": "true"
                },
                {
                    "name" : "DD_CONTAINER_EXCLUDE",
                    "value": "name:datadog-agent"
                },
                {
                    "name": "DD_APM_ENABLED",
                    "value": "true"
                },
                {
                    "name": "DD_APM_NON_LOCAL_TRAFFIC",
                    "value": "true"
                },
                {
                    "name": "DD_CATEGORY",
                    "value": "sourcecode"
                }
            ],
            "portMappings": [
                {
                    "hostPort": 8126,
                    "containerPort": 8126
                }
            ],
            "memory": 200,
            "mountPoints": [
                {
                    "sourceVolume": "docker_sock",
                    "containerPath": "/var/run/docker.sock",
                    "readOnly": false
                },
                {
                    "sourceVolume": "proc",
                    "containerPath": "/host/proc",
                    "readOnly": true
                },
                {
                    "sourceVolume": "cgroup",
                    "containerPath": "/host/sys/fs/cgroup",
                    "readOnly": true
                },
                {
                    "sourceVolume": "awseb-logs-nginx-proxy",
                    "containerPath": "/var/log/nginx",
                    "readOnly": true
                },
                {
                    "sourceVolume": "php-logs",
                    "containerPath": "/var/log/php-app",
                    "readOnly": true
                },
                {
                    "sourceVolume": "php-log-integration-config",
                    "containerPath": "/etc/datadog-agent/conf.d/php.d/conf.yaml",
                    "readOnly":true
                }
            ]
        },
        {
            "essential": true,
            "image": "649208843984.dkr.ecr.us-west-2.amazonaws.com/php7:2.0.1",
            "memory": 2048,
            "mountPoints": [
                {
                    "containerPath": "/var/www/html",
                    "readOnly": true,
                    "sourceVolume": "php-app"
                },
                {
                    "containerPath": "/apns",
                    "readOnly": true,
                    "sourceVolume": "apns"
                },
                {
                    "containerPath": "/var/log/php-app",
                    "sourceVolume": "awseb-logs-php-app"
                },
                {
                    "containerPath": "/tmp",
                    "readOnly": false,
                    "sourceVolume": "tmp"
                },
                {
                    "containerPath": "/jwt",
                    "readOnly": true,
                    "sourceVolume": "jwt"
                }
            ],
            "Update": "true",
            "name": "php-app",
            "links": [
                "dd-agent:dd-agent"
            ]
        },
        {
            "essential": true,
            "image": "nginx",
            "links": [
                "php-app",
                "dd-agent:dd-agent"
            ],
            "memory": 1536,
            "mountPoints": [
                {
                    "containerPath": "/var/www/html",
                    "readOnly": true,
                    "sourceVolume": "php-app"
                },
                {
                    "containerPath": "/etc/nginx/conf.d",
                    "readOnly": true,
                    "sourceVolume": "nginx-proxy-conf"
                },
                {
                    "containerPath": "/var/log/nginx",
                    "sourceVolume": "awseb-logs-nginx-proxy"
                }
            ],
            "name": "nginx-proxy",
            "portMappings": [
                {
                    "containerPort": 80,
                    "hostPort": 80
                }
            ]
        }
    ],
    "volumes": [
        {
            "name": "apns",
            "host": {
                "sourcePath": "/apns"
            }
        },
        {
            "name": "php-logs",
            "host": {
                "sourcePath": "/var/log/containers/php-app"
            }
        },
        {
            "name": "php-app",
            "host": {
                "sourcePath": "/var/app/current/php-app"
            }
        },
        {
            "name": "nginx-proxy-conf",
            "host": {
                "sourcePath": "/var/app/current/proxy/conf.d"
            }
        },
        {
            "name": "tmp",
            "host": {
                "sourcePath": "/tmp"
            }
        },
        {
            "name": "jwt",
            "host": {
                "sourcePath": "/jwt"
            }
        },
        {
            "name": "docker_sock",
            "host": {
                "sourcePath": "/var/run/docker.sock"
            }
        },
        {
            "name": "proc",
            "host": {
                "sourcePath": "/proc/"
            }
        },
        {
            "name": "cgroup",
            "host": {
                "sourcePath": "/cgroup/"
            }
        },
        {
            "name": "php-log-integration-config",
            "host": {
                "sourcePath": "/datadog/php.d/conf.yaml"
            }
        }
    ]
}

Datadog agent logs shows this after deploy:

2021-07-17 01:30:48 UTC | CORE | INFO | (pkg/serializer/serializer.go:356 in sendMetadata) | Sent metadata payload, size (raw/compressed): 1146/310 bytes.
2021-07-17 01:30:49 UTC | PROCESS | INFO | (collector.go:208 in func1) | Delivery queues: process[size=0, weight=0], pod[size=0, weight=0]
2021-07-17 01:30:55 UTC | CORE | INFO | (pkg/serializer/serializer.go:376 in SendJSONToV1Intake) | Sent processes metadata payload, size: 1394 bytes.
2021-07-17 01:31:19 UTC | TRACE | INFO | (pkg/trace/info/stats.go:101 in LogStats) | No data received
2021-07-17 01:31:49 UTC | PROCESS | INFO | (collector.go:208 in func1) | Delivery queues: process[size=0, weight=0], pod[size=0, weight=0]
2021-07-17 01:32:19 UTC | TRACE | INFO | (pkg/trace/info/stats.go:101 in LogStats) | No data received
2021-07-17 01:32:19 UTC | PROCESS | INFO | (collector.go:160 in runCheck) | Finish container check #340 in 27.457254ms
2021-07-17 01:32:48 UTC | CORE | INFO | (cmd/agent/app/run.go:110 in func2) | Received signal 'terminated', shutting down...
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/collector/runner/runner.go:149 in Stop) | Runner is shutting down...
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/collector/python/subprocesses.go:48 in TerminateRunningProcesses) | Canceling all running python subprocesses
2021-07-17 01:32:48 UTC | PROCESS | INFO | (pkg/process/util/signal_nowindows.go:21 in HandleSignals) | Caught signal 'terminated'; terminating.
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/aggregator/aggregator.go:667 in run) | Stopping aggregator
2021-07-17 01:32:48 UTC | PROCESS | INFO | (pkg/forwarder/forwarder.go:389 in Stop) | stopping the Forwarder
2021-07-17 01:32:48 UTC | TRACE | INFO | (main.go:25 in handleSignal) | received signal 15 (terminated)
2021-07-17 01:32:48 UTC | TRACE | INFO | (pkg/trace/agent/agent.go:133 in loop) | Exiting...
2021-07-17 01:32:48 UTC | PROCESS | INFO | (pkg/forwarder/domain_forwarder.go:278 in Stop) | domainForwarder stopped
2021-07-17 01:32:48 UTC | PROCESS | INFO | (pkg/forwarder/forwarder.go:389 in Stop) | stopping the Forwarder
2021-07-17 01:32:48 UTC | TRACE | INFO | (pkg/trace/stats/concentrator.go:100 in Run) | Exiting concentrator, computing remaining stats
2021-07-17 01:32:48 UTC | PROCESS | INFO | (pkg/forwarder/domain_forwarder.go:278 in Stop) | domainForwarder stopped
2021-07-17 01:32:48 UTC | PROCESS | INFO | (pkg/forwarder/forwarder.go:389 in Stop) | stopping the Forwarder
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/forwarder/forwarder.go:389 in Stop) | stopping the Forwarder
trace-agent exited with code 0, disabling
process-agent exited with code 0, disabling
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/forwarder/domain_forwarder.go:278 in Stop) | domainForwarder stopped
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/logs/logs.go:128 in Stop) | Stopping logs-agent
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/logs/input/docker/tailer.go:84 in Stop) | Stop tailing container: 8bbd4d72395c
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/logs/input/docker/tailer.go:84 in Stop) | Stop tailing container: 83c7171252ba
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/logs/input/docker/tailer.go:84 in Stop) | Stop tailing container: c9e5568bb4b2
2021-07-17 01:32:48 UTC | CORE | INFO | (pkg/logs/input/docker/tailer.go:84 in Stop) | Stop tailing container: eeb5f67f9fea
2021-07-17 01:32:49 UTC | CORE | INFO | (pkg/logs/logs.go:140 in Stop) | logs-agent stopped
2021-07-17 01:32:49 UTC | CORE | INFO | (cmd/agent/app/run.go:423 in StopAgent) | See ya!
AGENT EXITED WITH CODE 0, SIGNAL 0, KILLING CONTAINER
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

I can’t see neither APM nor Logs (which are configured both as files and stdout)

Source: Docker Questions

LEAVE A COMMENT