Sign inSign up

wydler/logrotate

By wydler

Updated 5 months ago

Docker image for rotating log files from other containers

Buildkit cache
Image
0

3.0K

wydler/logrotate repository overview

Docker Logrotate Logo

Docker Logrotate

A lightweight Docker image that performs log rotation for other containers running in the same Docker environment.

Build and Publish Docker Image

📦 Available Tags

Choose the right version for your environment:

  • latest: Latest stable build - recommended for testing
  • 1.2.3: Specific version - recommended for production

Example: wydler/logrotate:1.2.3

🔄 Overview

This container runs logrotate to manage log files from other containers in your Docker environment. It helps prevent log files from growing too large and consuming all available disk space.

✨ Features

  • Rotates log files from other containers
  • Configurable rotation interval (hourly, daily, weekly, monthly, yearly)
  • Configurable size-based rotation
  • Configurable number of backup copies to keep
  • Timezone support
  • Automatic compression of rotated logs

🚀 Quick Start

services:
  # Example service that generates logs
  app:
    image: your-app-image
    volumes:
      - logs:/logs

  # Logrotate service
  logrotate:
    image: wydler/logrotate:latest
    volumes:
      - logs:/logs
    environment:
      TZ: "Europe/Berlin"
      LOGS_PATH: "/logs/*.log"
      TRIGGER_INTERVAL: daily
      MAX_SIZE: 100M
      MAX_BACKUPS: 30
      DELAYCOMPRESS: "true"

volumes:
  logs:
    driver: local

⚙️ Environment Variables

VariableDescriptionDefaultOptions
LOGS_PATHPath to log files to rotate/logs/*.logAny valid path pattern
TRIGGER_INTERVALHow often to rotate logsdailyhourly, daily, weekly, monthly, yearly
MAX_SIZERotate if log file size reaches this thresholdNONENONE or size (e.g., 1K, 10M, 1G)
MAX_BACKUPSNumber of backup copies to keep365Any positive integer
DELAYCOMPRESSDelay compression of rotated logs until next rotationtruetrue, false
TZTimezoneUTCAny valid timezone (e.g., Europe/Berlin)

📄 License

This project is licensed under the MIT License.

Tag summary

Content type

Image

Digest

sha256:7cf530d44

Size

5.9 MB

Last updated

5 months ago

docker pull wydler/logrotate