intermediateMonitoring: Logs, Metrics, Prometheus & Grafana

What problem does log rotation solve, and how do you configure it?

Without rotation, the json-file driver appends to a single ever-growing log file per container, which can exhaust host disk space over time for long-running, chatty services. You configure max-size and max-file either globally in /etc/docker/daemon.json or per-container via --log-opt, capping both individual file size and the number of rotated files retained.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What is the difference between Prometheus's pull model and a push-based metrics system?← Back to all Docker questions