I have three docker containers running; server, proxy server and a daemon checking for changes between two databases. I've used docker-compose and an ec2 instance for testing. I would like to stream the logs to AWS CloudWatch and have used awslogs driver on all three containers. The two servers send logs to CloudWatch every time there is an event. These arrive in their CloudWatch streams in near realtime. Logs from the daemon appear to be chunked, arriving in batches every 6 minutes with around 8-9kb of log information.
I have tried setting the awslogs-multiline-pattern
from the docs. Logs still arrive with a 6 minute gap. Checking the default log file location for the daemon with docker inspect <container> | grep log
it is in the expected location for docker json logs. This is also true of the server if I disable awslogs driver. No logging library is used in the db sync daemon, just print statements, stdout. The server uses logrus and the proxy server is nginx.
Why do my server logs appear in CloudWatch in near realtime and the db sync daemon logs are chunked and delayed?