Skip to content

Adds logrotation #1140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 11, 2021
Merged

Adds logrotation #1140

merged 8 commits into from
Jul 11, 2021

Conversation

chaptergy
Copy link
Collaborator

This PR adds logrotation to the access and error logs of the hosts. both are rotated weekly. For access logs the last 4 files (=4 weeks) are kept, for error logs the last 10 files are kept.

Running performing the dry-run with

logrotate -d /etc/logrotate.d/nginx-proxy-manager

seems to work as expected, however we will have to wait to see if it actually does everything as expected.

Fixes #183.

@chaptergy chaptergy changed the title Adds logrotation Draft: Adds logrotation May 30, 2021
@chaptergy
Copy link
Collaborator Author

Hm, when running the buildx script locally on the current dev branch it runs into the same error as the pipeline, so i think this has nothing to do with my changes, though it does seem suspicios as the line with my changes seems to cause the error

@jc21
Copy link
Member

jc21 commented Jun 18, 2021

This is an automated message from CI:

Docker Image for build 3 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-1140

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

@jc21
Copy link
Member

jc21 commented Jun 18, 2021

This is an automated message from CI:

Docker Image for build 4 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-1140

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

@jc21
Copy link
Member

jc21 commented Jun 19, 2021

So when/how does the logrotate binary run?

@chaptergy
Copy link
Collaborator Author

Logrotate should automatically add itself as a daily cronjob but only rotate the logs weekly as per the config.

@jc21
Copy link
Member

jc21 commented Jun 20, 2021

So the problem with that is that there is no cron daemon running in the container so nothing will happen.

You can either add crond and start it in the same way as the nginx service or have the nodejs backend run the log rotate binary in a similar way to how it runs certbot periodically.

@chaptergy
Copy link
Collaborator Author

Ah, I assumed certbot was running via cron as well, not manually, but makes sense.

@jc21
Copy link
Member

jc21 commented Jun 29, 2021

This is an automated message from CI:

Docker Image for build 6 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-1140

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

nginx cannot create the folder structure for logs
@jc21
Copy link
Member

jc21 commented Jun 29, 2021

This is an automated message from CI:

Docker Image for build 7 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-1140

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

@chaptergy
Copy link
Collaborator Author

I finally got around to changing it. I'm now running it on my production server for a while, to verify it working.

@jc21
Copy link
Member

jc21 commented Jul 9, 2021

This is an automated message from CI:

Docker Image for build 8 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-1140

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

@chaptergy
Copy link
Collaborator Author

chaptergy commented Jul 9, 2021

I have now hat it running on my personal production server for a while, and I think it is ready to be merged.

@chaptergy chaptergy changed the title Draft: Adds logrotation Adds logrotation Jul 9, 2021
@chaptergy chaptergy requested a review from jc21 July 9, 2021 11:24
@jc21 jc21 merged commit e91019f into develop Jul 11, 2021
@jc21 jc21 deleted the adds-logrotation branch September 8, 2021 22:05
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.

Logs grow indefinitely
2 participants