Skip to content

Rotate Gunicorn access logs in Docker Compose - #226

Closed
Michael-C-Strobel wants to merge 1 commit into
mwang87:devfrom
Michael-C-Strobel:fix/rotate-gunicorn-access-logs
Closed

Rotate Gunicorn access logs in Docker Compose#226
Michael-C-Strobel wants to merge 1 commit into
mwang87:devfrom
Michael-C-Strobel:fix/rotate-gunicorn-access-logs

Conversation

@Michael-C-Strobel

Copy link
Copy Markdown
Contributor

Summary

  • Add a lightweight logrotate sidecar to the production Docker Compose configuration.
  • Rotate the web and API Gunicorn access logs at 100 MB.
  • Retain five rotations and compress older files.
  • Check log sizes every 15 minutes.
  • Use copytruncate, avoiding host cron configuration and Docker-socket access.
  • Keep access logs out of container stdout/stderr.

Motivation

The bind-mounted Gunicorn access logs bypass Docker's existing json-file
limits and currently grow without bounds. On the production host, the web and
API access logs had grown to approximately 10.6 GB and 3.5 GB.

Validation

  • Production Compose configuration validates successfully.
  • The logrotate configuration parses successfully.
  • The Alpine/logrotate sidecar image builds successfully.
  • The sidecar startup script passes shell syntax validation.

@Michael-C-Strobel
Michael-C-Strobel force-pushed the fix/rotate-gunicorn-access-logs branch from 0e892b7 to 2df1ba5 Compare August 28, 2026 17:16
@Michael-C-Strobel

Copy link
Copy Markdown
Contributor Author

Closing this as superseded by the logging-only approach. We are preserving the existing access-log behavior and full history, while limiting only Docker JSON stdout/stderr logs in the relevant service repositories.

@Michael-C-Strobel
Michael-C-Strobel deleted the fix/rotate-gunicorn-access-logs branch August 28, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant