VPS1Euro Dashboard Wiki

Complete client guide: infrastructure, services, account and support.

FR EN

Rotation and archiving of logs (logrotate)

Prevent log files from saturating the disk by configuring their automatic rotation.

What this tutorial does

The tutorial "Rotation and archiving of logs (logrotate)" helps you achieve this goal:

Prevent log files from saturating the disk by configuring their automatic rotation.

← Back to tutorials
1 profiles 22 steps 1 commands ~15 min

Debian/Ubuntu

  1. logrotate is installed by default. Check: logrotate --version
  2. --- Create a rule for a custom application ---
  3. Create /etc/logrotate.d/my-app:
  4. /var/log/mon-app/*.log {
  5. daily
  6. missingok
  7. rotate 14
  8. compress
  9. delaycompress
  10. notifempty
  11. create 0640 www-data adm
  12. sharedscripts
  13. postrotate
  14. systemctl reload mon-app > /dev/null 2>&1 || true
  15. endscript
  16. }
  17. --- Test the configuration ---
  18. logrotate --debug /etc/logrotate.d/mon-app
  19. --- Force manual rotation ---
  20. logrotate --force /etc/logrotate.d/mon-app
  21. --- Check rotation history ---
  22. cat /var/lib/logrotate/status