Skip to content

Commit

Permalink
Join the logging of the message and the newline into one Write
Browse files Browse the repository at this point in the history
Fixes #646
  • Loading branch information
andrewkroh committed Jan 6, 2016
1 parent 43233eb commit c3d0fa7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit c3d0fa7

Please sign in to comment.