Exclusive Metin2 game shield on FreeBSD: Automatic siege mode, VIP list, and whitelist from your dashboard. See how it works
Create a server

Guide

How to Install and Use logrotate

Logs grow quietly. logrotate cuts, compresses and drops old files based on a rule.

Steps

  1. On Ubuntu it is usually installed. Check the binary:

    logrotate --version
  2. Create a rule for your app (example):

    sudo nano /etc/logrotate.d/my-app
  3. Example contents:

    /var/log/my-app/*.log {
        daily
        rotate 14
        compress
        delaycompress
        missingok
        notifempty
        copytruncate
    }
  4. Dry-run, then force one rotation:

    sudo logrotate -d /etc/logrotate.d/my-app
    sudo logrotate -f /etc/logrotate.d/my-app

Tips

  • copytruncate avoids restarting a process that keeps writing the same file.
  • Check df -h /var if the disk grows — often unrotated logs.

ext step

VMe disk with room for logs and backups: Xernode Cloud VPS.

Related guides