I run containers in ECS on python docker image which has ssh installed because sometimes I need to login to the container.
Whatever logs are outputted using print in the python script show up in the log group for the container
The issue is it's not live log being sent. It is in batches. Container runs for 40 hours and the logs get sent in batches with hours of delay in between
Is there a way to ensure the logs sent from containers are live rather than in batches?
The Dockerfile I use has the following structure
FROM python:3.7
RUN apt-get update && \
apt-get install -y cron curl dnsutils htop iputils-ping openssh-server lsof nano net-tools procps vim && \
apt-get clean
...
EXPOSE 22
WORKDIR /usr/src/app
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
CMD service ssh start && python script.py
Task definition has the logging enabled
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/my-python-td",
"awslogs-region": "us-west-1",
"awslogs-stream-prefix": "ecs"
}
}