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

Join the logging of the message and the newline into one Write #650

Merged
merged 1 commit into from
Jan 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ https://github.com/elastic/beats/compare/1.0.0...master[Check the HEAD diff]
==== Bugfixes

*Affecting all Beats*
- Fix logging issue with file based output where newlines could be misplaced
during concurrent logging {pull}650[650]

*Packetbeat*
- Fix setting direction to out and use its value to decide when dropping events if ignore_outgoing is enabled {pull}557[557]
Expand Down
8 changes: 3 additions & 5 deletions libbeat/logp/file_rotator.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,13 @@ func (rotator *FileRotator) WriteLine(line []byte) error {
return err
}
}

line = append(line, '\n')
_, err := rotator.current.Write(line)
if err != nil {
return err
}
_, err = rotator.current.Write([]byte("\n"))
if err != nil {
return err
}
rotator.current_size += uint64(len(line) + 1)
rotator.current_size += uint64(len(line))

return nil
}
Expand Down