Skip to main content
Check the size of log files on Lager Boxes, and remove old ones.

Syntax

Commands

These commands measure and delete log files. They do not print log content. To read the logs of the box services, see the Reading Service Logs section below.

Command Reference

size

Check the size of ~/box/logs on one Lager Box, or on every saved Lager Box.
Options:
  • --box BOX - Specific Lager Box (if not specified, checks all)
  • --verbose / -v - Show individual log files
Examples:
Output:

clean

Delete the *.log files in ~/box/logs that are older than a number of days.
Options:
  • --box BOX (required) - Lager Box to clean
  • --older-than DAYS - Remove logs older than N days (default: 1)
  • --yes - Skip confirmation prompt
Examples:
Output:

docker

Check the size of the Docker log file of each running container. A Lager Box runs one container, lager.
Options:
  • --box BOX (required) - Lager Box to check
  • --container NAME - Specific container (default: all)
Examples:
Output:
The command reads the log file with sudo -n over a non-interactive SSH session. If sudo asks for a password on the box, the size line says unknown. The command then tells you to allow sudo -n ls for the login user of the box.

Log Rotation

Docker containers use automatic log rotation:
  • Maximum size: 10 MB per file
  • Maximum files: 3 (rotates oldest)
This means Docker logs are self-managing and do not grow without a limit.

Size Thresholds

The size command uses warning thresholds:

What Gets Cleaned

The clean command removes:
  • Files that match *.log in ~/box/logs on the box host, and that are older than --older-than days
It does not remove:
  • System logs in /var/log/
  • Docker container logs (managed separately)
  • The service logs inside the container
  • Files newer than --older-than threshold

Reading Service Logs

The box services write their logs inside the lager container: To read the last lines of a log, run docker exec on the box:

Automation

Schedule regular log cleaning:

Examples


Notes

  • --box takes the name of a saved Lager Box. An IP address is not accepted.
  • These commands connect over SSH as the user that you stored with lager boxes add --user, or as lagerdata if you stored none. They use key authentication only: the lager_box key first, then your own SSH keys.
  • Docker logs are automatically rotated
  • Use --verbose to identify large log files
  • Regular cleaning prevents disk space issues