mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-08 05:39:49 -05:00
[GH-ISSUE #2644] access.log eating disk space #8966
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @svillar on GitHub (Mar 13, 2026).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/2644
Describe the Bug
After some months of use my access.log is already > 3G. I think traefik config should set size limits and also enable compression
Environment
To Reproduce
Just run it
Expected Behavior
Logs are limited in size and compressed (and rotated)
@LaurenceJJones commented on GitHub (Mar 13, 2026):
Unfortunately traefik doesn't have log size or rotation feature AFAIK. (Might have changed since I last looked but let me know if I'm wrong)
However, the installer could detect if logrotate is available (99% of the time it is) and scaffold it for you.
@svillar commented on GitHub (Mar 13, 2026):
wouldn't something like this work
as there is for
log(already in the default config)EDIT: logrotate is in the system but I don't think it works with "unusual" locations. My access log is under config/traefik/logs
@LaurenceJJones commented on GitHub (Mar 13, 2026):
Not sure where you got those from as docs state https://doc.traefik.io/traefik/v3.0/observability/access-logs/#log-rotation
Log and access log have different properties.
@svillar commented on GitHub (Mar 13, 2026):
Right, replying to myself, that temptative config is wrong and makes traefik fail.
With regard to log rotate it should be a matter of adding a new file to
/etc/logrotate.dFeel free to close it if you think that nothing can be done from pangolin side, maybe adding something to the docs?
@svillar commented on GitHub (Mar 13, 2026):
Ah I missed this, could you share a sample config generated by the installer? I already have one but I wonder whether it should stop some service and resume it before/after rotating
@LaurenceJJones commented on GitHub (Mar 13, 2026):
The community has already answered this question on stackoverflow
https://stackoverflow.com/questions/49450422/how-to-enable-logrotation-for-traefik
but yeah, we can explore options for the installer (its doesnt already do this, my previous message was to say "we can explore options to add it") im sure that the access logs are only configured when using crowdsec.
@AstralDestiny commented on GitHub (Mar 21, 2026):
Which stuff do you have in your logs settings if I might ask? if you add more stuff to be kept in logging the logs can inflate fast.
@TJothiprakash commented on GitHub (Apr 4, 2026):
Hi, I'd like to take a stab at this if no one else is working on it!
My proposed approach:
logrotateconfig file scaffolded by the installer for the Traefik access log atconfig/traefik/logs/postrotatehook to send SIGUSR1 to the Traefik container so it reopens the log file without a full restartlogrotateis available on the host systemPlease let me know if this aligns with what you had in mind, or if there are any constraints I should be aware of before I open a PR. Thanks!
@oschwartz10612 commented on GitHub (Apr 4, 2026):
A user has made a PR like this before. We ended up not wanting to take
it because we do not want to make the default install config any more
complicated than it needs to be. We want to keep it simple.
Perhaps if the traefik access logs are enabled we should have a detailed
docs page explaining how to manage it? PR welcome for that! :}
@LaurenceJJones commented on GitHub (Apr 6, 2026):
Just to point out that access log is only enabled when CrowdSec option is selected from the installer. Maybe even if the installer were to point users in the direction of "Enabling CrowdSec enables access logs if you want to configure log rotation go to XYZ"?
but maybe we can discuss more @oschwartz10612
@oschwartz10612 commented on GitHub (Apr 6, 2026):
Ahh good point @LaurenceJJones. @TJothiprakash I do actually think then
I would be okay with adding this to the Crowdsec docker compose. I dont
have any issues making that install larger and more complicated.
@sidd190 commented on GitHub (Apr 18, 2026):
Hii, I have the codebase setup locally.
I'm thinking of approaching this by adding a
setupTraefikLogRotate()function to theinstall/crowdsec.gofile. This will write a logrotate file to/etc/logrotate.d/pangolin-traefikpointing at<installDir>/config/traefik/logs/access.log. Or should I add a container approach here, using a small container for the crowdsec compose fragment running logrotate as a cron?I will update the docs in the documentation repo with a simultaneous PR describing why the log grows, what one might and might not want, and how crowdsec installation was updated if need be.
Does that sound good?
@AstralDestiny commented on GitHub (Apr 18, 2026):
Sounds good, Though curious with my deployment (differs from pangolin's orignal) My log file for crowdsec to read is only 185mb and the log goes back 2 years so far. Guess be more curious if the current log is writing additional fields that aren't needed for crowdsec's operation.
@sidd190 commented on GitHub (Apr 19, 2026):
Hmmm I tried to go through the fields, but that doesn't seem like the elephant in the room for this problem. I think fields like TLSVersion, TLSCipher, DownstreamContentSize, RetryAttempts, Content-Type header aren't being directly used by the crowdsec detection scenarios, but the major problem is also about the growth due to traffic volume, so logrotate and log size limits will help reduce this and maybe these fields can be dropped in a seperate PR after a green light on what can and can't be reduced maybe?
@sidd190 commented on GitHub (Apr 19, 2026):
I've added a paired code - documentation update from what I could understand. Can someone please take a look and review it whenever possible.
@AstralDestiny commented on GitHub (Apr 19, 2026):
For me, honestly don't even need User-Agent as I mostly have whitelists contained against traefik's own routers.