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

Open log files with O_APPEND so log rotation can work properly #9468

Closed
wants to merge 3 commits into from

Conversation

vrivanov-rb
Copy link

If logging to a file is used, and external log rotation is setup e.g. with logrotate, teleport would end up creating a sparse file because writes to the log file opened without O_APPEND would resume writing to the last write location even though the log file might have been truncated by logrotate.

Fix this by opening the log file with O_APPEND. This will cause all subsequent writes to write to the end of the file, thus starting from the beginning of the empty file after a truncate has been performed by logrotate.

If logging to a file is used, and external log rotation is setup e.g.
with logrotate, teleport would end up creating a sparse file because
`write`s to the log file opened without O_APPEND would resume writing
to the last write location even though the log file might have been
truncated by logrotate.

Fix this by opening the log file with O_APPEND. This will cause all
subsequent `write`s to write to the end of the file, thus starting from
the beginning of the empty file after a truncate has been performed by
logrotate.
@zmb3
Copy link
Collaborator

zmb3 commented Jul 14, 2022

/gcbrun

@corkrean corkrean added the c-dx Internal Customer Reference label Jul 14, 2022
@zmb3 zmb3 enabled auto-merge (squash) July 26, 2022 15:46
@corkrean
Copy link
Contributor

Hey @vrivanov-rb, thanks for the change, we'd like to merge this. Can you rebase it or do you want us to take it over?

Copy link
Contributor

@russjones russjones left a comment

Choose a reason for hiding this comment

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

@Erick-Reyes Erick-Reyes added the c-stz Internal Customer Reference label Oct 20, 2022
auto-merge was automatically disabled January 27, 2023 20:19

Merge queue setting changed

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@phall-teleport phall-teleport added the c-hm Internal Customer Reference label May 29, 2024
@zmb3 zmb3 closed this Aug 6, 2024
@pschisa pschisa added the c-pm Internal Customer Reference label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-dx Internal Customer Reference c-hm Internal Customer Reference c-pm Internal Customer Reference c-stz Internal Customer Reference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants