Search code examples
amazon-ecs

How do I stream multiple logs to AWS CloudWatch from inside a Docker instance?


I am setting up Debian-based containers via AWS ECS on EC2 instances. The container has a number of logs I want in separate CloudWatch streams.

The "expected" setup is to simply stream stdout to CloudWatch, but that only permits for one stream.

I tried to install the cloudwatch agent, but ran into myriad problems. System has not been booted with systemd as init system (PID 1). Can't operate. being the starting point.

Is this possible?


Solution

  • In the end I just streamed everything to stdout. In my case it was Django/Gunicon:

    echo "Starting gunicorn!"
    gunicorn -c /etc/gunicorn/conf.py mydjangoapp.wsgi:application --bind unix:/tmp/app_proxy.sock --access-logfile - --error-logfile - --worker-tmp-dir /dev/shm &
    
    echo "Starting nginx..."
    nginx -g 'daemon off;'