Skip to content

integrating vegardit/traefik-logrotate#740

Closed
TuncTaylan wants to merge 1 commit intofosrl:devfrom
TuncTaylan:integration-of-traefik-logrotate
Closed

integrating vegardit/traefik-logrotate#740
TuncTaylan wants to merge 1 commit intofosrl:devfrom
TuncTaylan:integration-of-traefik-logrotate

Conversation

@TuncTaylan
Copy link
Copy Markdown
Contributor

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

Integrating a dockerized solution for traefik log rotation using vegardit/traefik-logrotate.

How to test?

Just start the stack, it'll rotate the traefik logs.

@oschwartz10612
Copy link
Copy Markdown
Member

Hi!

Thanks so much for taking the time to put this together. I dont think we want to include by default an extra container right now. I think there was also basic log rotation added in #736.

Feel free to reopen and let me know your thoughts. I think this might be best as a docs page explaining how to add it if it really is doing something different enough to #736.

@TuncTaylan
Copy link
Copy Markdown
Contributor Author

TuncTaylan commented May 22, 2025

Hey @oschwartz10612 ,

The PR #736 was intended to support log rotation and necessary configuration for Traefik. As outlined in Traefik's documentation, log rotation still requires an external program to manage the actual rotation:

"Traefik will close and reopen its log files, assuming they're configured, on receipt of a USR1 signal. This allows the logs to be rotated and processed by an external program, such as logrotate."

The reasoning and context are described in issue #693, which is why I preferred a Dockerized approach over modifying and running external programs on the host.

Let me know your thoughts!

Edit: I can't reopen it without creating another PR, so I'll just wait for your answer.

@buildplan
Copy link
Copy Markdown

buildplan commented May 23, 2025

This can be achieved by simply creating a simple log-rotation file in /etc/logrotate.d/ - like the below - Adding one more container is not something I would personally like just for this.

/home/user/Pangolin/config/traefik/logs/access.log {
    daily
    rotate 5
    compress
    delaycompress
    missingok
    notifempty
    create 0644 user user
    postrotate
        # Send USR1 signal to the traefik container(id=7f1c8061f54c) to reopen logs
        docker kill -s USR1 7f1c8061f54c > /dev/null 2>&1
    endscript
}

@TuncTaylan
Copy link
Copy Markdown
Contributor Author

TuncTaylan commented May 23, 2025

Of course, but in cases, where you aren't able or don't want to edit the host system, more secure and compatible approach is the dockerized way.

Also "logrotate" is not installed in every distribution...

@oschwartz10612
Copy link
Copy Markdown
Member

Ahh okay thanks for clarifying I was not aware of this I apologize. @miloschwartz what do you think? Not sure if we want this extra container always distributed or not in every install? I am tempted to suggest we make this a docs page?

@oschwartz10612
Copy link
Copy Markdown
Member

Hey sorry I have not given this the attention it deserves. @TuncTaylan what if we update the installer to include the logrotate when installing crowdsec and otherwise make sure the access log is turned off?

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.

3 participants