{"id":24316248,"url":"https://github.com/vegardit/docker-traefik-logrotate","last_synced_at":"2025-10-25T13:02:17.569Z","repository":{"id":38359039,"uuid":"386038915","full_name":"vegardit/docker-traefik-logrotate","owner":"vegardit","description":"Lightweight Docker image to be used in conjunction with a dockerized Traefik instance to rotate Traefik's access logs.","archived":false,"fork":false,"pushed_at":"2024-12-17T20:45:17.000Z","size":50,"stargazers_count":53,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-15T02:59:02.726Z","etag":null,"topics":["docker-image","logrotate","traefik"],"latest_commit_sha":null,"homepage":"https://buymeacoffee.com/vegardit","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vegardit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-14T18:27:37.000Z","updated_at":"2025-01-06T18:55:08.000Z","dependencies_parsed_at":"2024-11-21T05:28:41.570Z","dependency_job_id":null,"html_url":"https://github.com/vegardit/docker-traefik-logrotate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vegardit%2Fdocker-traefik-logrotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vegardit%2Fdocker-traefik-logrotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vegardit%2Fdocker-traefik-logrotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vegardit%2Fdocker-traefik-logrotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vegardit","download_url":"https://codeload.github.com/vegardit/docker-traefik-logrotate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234360836,"owners_count":18819962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-image","logrotate","traefik"],"created_at":"2025-01-17T12:19:57.580Z","updated_at":"2025-09-26T23:31:29.091Z","avatar_url":"https://github.com/vegardit.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# vegardit/traefik-logrotate \u003ca href=\"https://github.com/vegardit/traefik-logrotate/\" title=\"GitHub Repo\"\u003e\u003cimg height=\"30\" src=\"https://raw.githubusercontent.com/simple-icons/simple-icons/develop/icons/github.svg?sanitize=true\"\u003e\u003c/a\u003e\n\n[![Build Status](https://github.com/vegardit/docker-traefik-logrotate/workflows/Build/badge.svg \"GitHub Actions\")](https://github.com/vegardit/docker-traefik-logrotate/actions?query=workflow%3ABuild)\n[![License](https://img.shields.io/github/license/vegardit/docker-traefik-logrotate.svg?label=license)](#license)\n[![Docker Pulls](https://img.shields.io/docker/pulls/vegardit/traefik-logrotate.svg)](https://hub.docker.com/r/vegardit/traefik-logrotate)\n[![Docker Stars](https://img.shields.io/docker/stars/vegardit/traefik-logrotate.svg)](https://hub.docker.com/r/vegardit/traefik-logrotate)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)\n\n1. [What is it?](#what-is-it)\n1. [Usage](#usage)\n1. [License](#license)\n\n\n## \u003ca name=\"what-is-it\"\u003e\u003c/a\u003eWhat is it?\n\nA lightweight, multi-arch Docker image based on [alpine:3](https://hub.docker.com/_/alpine/tags?name=3) to be used in conjunction with\na dockerized [Traefik](https://traefik.io) instance to rotate [Traefik's access logs](https://doc.traefik.io/traefik/observability/access-logs/).\n\nAutomatically rebuilt **weekly** to include the latest OS security fixes.\n\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003eUsage\n\nExample `docker-compose.yml`:\n\n```yaml\nservices:\n\n  traefik:\n    image: traefik:latest\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock:ro\n      - /var/log/traefik:/var/log/traefik:rw  # folder containing access.log file\n    deploy:\n      restart_policy:\n        condition: on-failure\n        delay: 5s\n    # ... other configurations\n\n\n  logrotate:\n    image: vegardit/traefik-logrotate:latest\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock:rw # required to send USR1 signal to Traefik after log rotation\n      - /var/log/traefik:/var/log/traefik:rw # folder containing access.log file\n    environment:\n      TZ: \"Europe/Berlin\"\n      # all environment variables are optional and show the default values:\n      LOGROTATE_LOGS: \"/var/log/traefik/*.log\" # log files to rotate, directory must match volume mount\n      LOGROTATE_TRIGGER_INTERVAL: daily  # rotate daily, must be one of: daily, weekly, monthly, yearly\n      LOGROTATE_TRIGGER_SIZE: 50M        # rotate if log file size reaches 50MB\n      LOGROTATE_MAX_BACKUPS: 14          # keep 14 backup copies per rotated log file\n      LOGROTATE_START_INDEX: 1           # first rotated file is called access.1.log (ignored when dateext is enabled)\n      LOGROTATE_USE_DATEEXT: false       # use date extension instead of numbers (e.g., access.log-20240814)\n      LOGROTATE_DATEFORMAT: \"-%Y%m%d\"    # date format for rotated files when dateext is enabled\n      LOGROTATE_FILE_MODE: 0644          # file mode of the rotated file\n      LOGROTATE_FILE_USER: root          # owning user of the rotated file\n      LOGROTATE_FILE_GROUP: root         # owning group of the rotated file\n      CRON_SCHEDULE: \"* * * * *\"\n      CRON_LOG_LEVEL: 8                  # see https://unix.stackexchange.com/a/414010/378036\n      # command to determine the id of the container running Traefik:\n      TRAEFIK_CONTAINER_ID_COMMAND: docker ps --no-trunc --quiet --filter label=org.opencontainers.image.title=Traefik\n    deploy:\n      restart_policy:\n        condition: on-failure\n        delay: 5s\n```\n\n### Date-based Log Rotation\n\nTo use date-based naming for rotated files instead of numbered suffixes, enable the `dateext` option:\n\n```yaml\nservices:\n  logrotate:\n    image: vegardit/traefik-logrotate:latest\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock:rw\n      - /var/log/traefik:/var/log/traefik:rw\n    environment:\n      LOGROTATE_USE_DATEEXT: \"true\"       # Enable date-based naming\n      LOGROTATE_DATEFORMAT: \"-%Y%m%d\"     # Results in: access.log-20240814.gz\n      # Alternative formats:\n      # LOGROTATE_DATEFORMAT: \".%Y-%m-%d\" # Results in: access.log.2024-08-14.gz\n      # LOGROTATE_DATEFORMAT: \"_%Y%m%d_%H\" # Results in: access.log_20240814_15.gz (hourly)\n```\n\nWhen `LOGROTATE_USE_DATEEXT` is enabled:\n- Rotated files will be named with dates (e.g., `access.log-20240814.gz`)\n- The `LOGROTATE_START_INDEX` setting is ignored\n- Files are sorted lexically, so use year-month-day format for proper ordering\n- Supported format specifiers: `%Y` (year), `%m` (month), `%d` (day), `%H` (hour), `%M` (minute), `%S` (second)\n\n\n## \u003ca name=\"license\"\u003e\u003c/a\u003eLicense\n\nAll files in this repository are released under the [Apache License 2.0](LICENSE.txt).\n\nIndividual files contain the following tag instead of the full license text:\n```\nSPDX-License-Identifier: Apache-2.0\n```\n\nThis enables machine processing of license information based on the SPDX License Identifiers that are available here: https://spdx.org/licenses/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvegardit%2Fdocker-traefik-logrotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvegardit%2Fdocker-traefik-logrotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvegardit%2Fdocker-traefik-logrotate/lists"}