gliderlabs / logspout

Log routing for Docker container logs
MIT License
4.66k stars 680 forks source link

Missing container logs when using docker-compose up #510

Open abhaygupta97 opened 3 years ago

abhaygupta97 commented 3 years ago

I have a docker-compose.yml file which starts logspout container and other containers in my application. On doing docker-compose up, in some cases log files are not getting created for some containers.

When log files are not getting created, I saw in logspout logs that container log is getting created in pump.Run but not getting started. Eg: In following case for 2961bd4368e6, we see there is create log but no start log

2021/09/09 15:22:52 pump.Run() event: 6816c90083fc create
**2021/09/09 15:22:52 pump.Run() event: 2961bd4368e6 create**
2021/09/09 15:22:52 pump.Run() event: c5af90f76a7a create
2021/09/09 15:22:53 pump.Run() event: 6816c90083fc start
2021/09/09 15:22:53 pump.pumpLogs(): 6816c90083fc started, tail: all
2021/09/09 15:22:54 pump.Run() event: c5af90f76a7a start
2021/09/09 15:22:54 pump.pumpLogs(): c5af90f76a7a started, tail: all

Restarting the container for which logs are missing using sudo -E docker-compose -f <compose-file-path> restart <container-name> fixes the issue.

How to ensure that log files are not missing when doing docker-compose up?