Backups & Files · about 2 min · 5 steps
Rotate app logs
Stops an app's log files from filling the disk: each day the logs are compressed and old ones are deleted.
Runs on
- Debian / Ubuntu: supported
- RHEL / Fedora: supported
- Alpine: supported
What it changes on your server
- Installs logrotate if it's missing, and makes sure it runs daily.
- Adds a rule in /etc/logrotate.d/shellbay-… for the folder's *.log files: rotated daily, compressed, and kept for the days you choose.
- Logs are copied and emptied in place, so the app doesn't need restarting.
What Shellbay asks you
Which folder holds the logs?
The full path of the folder with your app's .log files. Logs that the system already rotates (e.g. /var/log/nginx) are refused.
- Log folder
- Text, up to 512 characters
Example:
/var/www/shop/logsHow many days of logs should be kept?
One compressed file is kept per day; older ones are deleted.
- Days to keep
- A whole number from 1 to 365. Default:
14
Example:
14
Steps
- Check the folder
- Install logrotate
- Add the rotation rule
- Make sure logrotate runs daily
- Check the rule
Shellbay checks the server before the first step, and stops at the first step that fails.
When it's done
- The .log files in ‹log folder› are rotated daily and kept for ‹days to keep› days. Rotated logs are named like app.log.1 and app.log.2.gz.