Docker & Containers (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
Container Logging Drivers and Log Rotation.
senior LevelSecurity & AuthDocker & Containers
In Simple Words:
By default, Docker writes stdout/stderr logs to JSON files (json-file). Without configuration, high-traffic applications generate hundreds of gigabytes of logs, filling up the server hard drive and crashing the host!
- Mitigation: Configure log rotation in
/etc/docker/daemon.json:"log-opts": { "max-size": "50m", "max-file": "5" }