Ship container logs to a central system.
IntermediateScenarioLimits, logging, health checks and restarts
Answer
Situation read → Hosts are ephemeral, logs must be centralised.
What I'd do → Options: run a collector (Fluent Bit, Vector, Promtail/Alloy) tailing /var/lib/docker/containers/*/*-json.log with Docker metadata; or use a driver (fluentd, gelf, awslogs, loki plugin). Collector approach is more resilient because blocking drivers can stall the app.
Why → The default blocking log mode can slow the app if the remote is down; set mode=non-blocking with max-buffer-size.
Interview tip → Structured JSON logs make queries easy.
More on Limits, logging, health checks and restarts
A Java container is OOM-killed at 512 MB. Why isn't the heap the whole story?IntermediateHow do you cap CPU and memory for a container and what happens on exceed?BeginnerLatency spikes though CPU usage looks low (50%).Advanced`docker logs` is empty but the app is running.BeginnerConfigure log rotation globally.BeginnerDefine a good restart policy for a production service.Beginner