diff --git a/output_file.go b/output_file.go index c0962b5d4..cd168db3c 100644 --- a/output_file.go +++ b/output_file.go @@ -225,17 +225,19 @@ func (o *FileOutput) Write(data []byte) (n int, err error) { o.queueLength = 0 } - o.writer.Write(data) - o.writer.Write([]byte(payloadSeparator)) + n, _ = o.writer.Write(data) + nSeparator, _ := o.writer.Write([]byte(payloadSeparator)) - o.totalFileSize += int64(len(data) + len(payloadSeparator)) + n += nSeparator + + o.totalFileSize += int64(n) o.queueLength++ if Settings.outputFileConfig.outputFileMaxSize > 0 && o.totalFileSize >= Settings.outputFileConfig.outputFileMaxSize { - return len(data), errors.New("File output reached size limit") + return n, errors.New("File output reached size limit") } - return len(data), nil + return n, nil } func (o *FileOutput) flush() {