Skip to content

Commit

Permalink
Merge pull request #650 from andrewkroh/bugfix/logging-newline
Browse files Browse the repository at this point in the history
Join the logging of the message and the newline into one Write
  • Loading branch information
ruflin committed Jan 7, 2016
2 parents 3f82184 + c3d0fa7 commit e22e626
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 e22e626

Please sign in to comment.