Skip to content
Shellbay

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

  1. 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/logs

  2. How 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

  1. Check the folder
  2. Install logrotate
  3. Add the rotation rule
  4. Make sure logrotate runs daily
  5. 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.