Skip to content
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

Enable loss less rotation of log files #2062

Merged
merged 1 commit into from
Sep 15, 2017

Conversation

m3co-code
Copy link
Contributor

There is the chance that Traefik looses log lines for requests during rotation of the log file. This is at the moment true for the traefik log file as well as the access log files. I added two unit tests to prove this. This was also responsible for one flaky behaviour in the integration test here.

For the traefik logs this is accomplished by opening the new log file before closing the previous one. The traefik logs use the global logrus instance and it is already protected by a mutex on rotation. For the access logs such a mutex also had to be introduced.

I think there is some potential in refactoring and aligning the two logging implementations in order to avoid duplicate code when it comes to the file handling and the logrus configuration. I will do this in a follow-up PR.

@ldez
Copy link
Contributor

ldez commented Sep 5, 2017

Could change the base branch of the PR to 1.4?

@m3co-code
Copy link
Contributor Author

Rebased and changed the base branch of the PR.

emilevauge
emilevauge previously approved these changes Sep 15, 2017
Copy link
Member

@emilevauge emilevauge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design LGTM
Thanks @marco-jantke

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emilevauge emilevauge dismissed their stale review September 15, 2017 08:49

design LGTM only :)

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

For the traefik logs this is accomplished by opening the new log file
before closing the previous one. The traefik logs use the global logrus
instance and it is already protected by a mutex on rotation.

For the access logs such a mutex also had to be introduced.
@ldez ldez changed the title enable loss less rotation of log files Enable loss less rotation of log files Sep 15, 2017
@traefiker traefiker merged commit cf387d5 into traefik:v1.4 Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants