Interview Prep/Linux/Storage, disks and filesystems

Your application logs fill disks on 100 servers. Design a log retention approach.

IntermediateScenarioStorage, disks and filesystems
Answer

Situation read → Local retention short, central retention long.

What I'd do →

  1. logrotate config per app:
/var/log/myapp/*.log {
    daily
    rotate 7
    compress
    delaycompress
    missingok
    notifempty
    copytruncate
    maxsize 500M
}
  1. Cap journald: SystemMaxUse=1G in /etc/systemd/journald.conf.
  2. Ship logs to a central system (Loki, Elasticsearch, CloudWatch) with an agent like Fluent Bit or Vector.
  3. Put /var/log on its own LV so it can't fill root.

Why → Local disks are for a few days of debugging; central storage gives search and long retention.

Interview tip → Explain copytruncate vs signalling the app (postrotate) and when each is safer.

All Linux questions Roadmap: Linux

More on Storage, disks and filesystems