You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight, multi-arch Docker image based on alpine:3 to be used in conjunction with
a dockerized Traefik instance to rotate Traefik's access logs.
Automatically rebuilt weekly to include the latest OS security fixes.
Usage
Example docker-compose.yml:
services:
traefik:
image: traefik:latestvolumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /var/log/traefik:/var/log/traefik:rw # folder containing access.log filedeploy:
restart_policy:
condition: on-failuredelay: 5s# ... other configurationslogrotate:
image: vegardit/traefik-logrotate:latestvolumes:
- /var/run/docker.sock:/var/run/docker.sock:rw # required to send USR1 signal to Traefik after log rotation
- /var/log/traefik:/var/log/traefik:rw # folder containing access.log fileenvironment:
TZ: "Europe/Berlin"# all environment variables are optional and show the default values:LOGROTATE_LOGS: "/var/log/traefik/*.log"# log files to rotate, directory must match volume mountLOGROTATE_TRIGGER_INTERVAL: daily # rotate daily, must be one of: daily, weekly, monthly, yearlyLOGROTATE_TRIGGER_SIZE: 50M# rotate if log file size reaches 50MBLOGROTATE_MAX_BACKUPS: 14# keep 14 backup copies per rotated log fileLOGROTATE_START_INDEX: 1# first rotated file is called access.1.logLOGROTATE_FILE_MODE: 0644# file mode of the rotated fileLOGROTATE_FILE_USER: root # owning user of the rotated fileLOGROTATE_FILE_GROUP: root # owning group of the rotated fileCRON_SCHEDULE: "* * * * *"CRON_LOG_LEVEL: 8# see https://unix.stackexchange.com/a/414010/378036# command to determine the id of the container running Traefik:TRAEFIK_CONTAINER_ID_COMMAND: docker ps --no-trunc --quiet --filter label=org.opencontainers.image.title=Traefikdeploy:
restart_policy:
condition: on-failuredelay: 5s