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

Rotate log files at newline boundaries #1048

Closed
sean- opened this issue Apr 7, 2016 · 9 comments
Closed

Rotate log files at newline boundaries #1048

sean- opened this issue Apr 7, 2016 · 9 comments

Comments

@sean-
Copy link
Contributor

sean- commented Apr 7, 2016

Issue

See comment: #1047 (comment) . The following needs to happen in Write() when the file size has been exhausted.

This should scan backwards through the buffer for a \n and write/flush everything before that. Whatever comes after that last \n should be moved to the beginning of the buffer and written out on the next write (as long as the line length is less than the buffer length, in which case you need to truncate). This only needs to happen on file rotation, not on write.

@sean-
Copy link
Contributor Author

sean- commented Jun 10, 2016

@diptanu did #1047 fix this issue? Can this issue be closed?

@cyrilgdn
Copy link

Any news?
Our applications logs are in json format and parsed by Logstash but Nomad truncate lines when rotating log files. So these json lines are invalid...

@camerondavison
Copy link
Contributor

I have the same problem as @cyrilgdn

@cyrilgdn
Copy link

@diptanu @sean- This issue seems to not be fixed currently. Is it planned for some version?

Thanks!

@schmichael schmichael changed the title Rotate files along newline boundaries... Rotate log files at newline boundaries Sep 28, 2017
@schmichael
Copy link
Member

We don't have it on our roadmap yet, but if someone wants to attempt a PR @sean-'s linked comment covers the desired behavior.

@lorenzo
Copy link

lorenzo commented Apr 12, 2018

We are experiencing this as a problem because we log in json format. Is this still out of scope?

@schmichael
Copy link
Member

schmichael commented Apr 13, 2018

@lorenzo Not out of scope. We haven't been able to prioritize it yet, sorry!

Please do vote on the parent issue with 👍 -- Github allows us to sort issues by upvotes, and we do use that when planning.

@camerondavison
Copy link
Contributor

Cc: @preetapan

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants