Skip to content

Commit

Permalink
Merge pull request #1322 from hashicorp/b-docker-logs-splicing
Browse files Browse the repository at this point in the history
Make line copy to avoid being overriden by subsequent scans
  • Loading branch information
dadgar committed Jun 20, 2016
2 parents 3c578fc + 7cd4866 commit fc4d489
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/driver/logging/syslog_parser_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ func NewDockerLogParser(logger *log.Logger) *DockerLogParser {
func (d *DockerLogParser) Parse(line []byte) *SyslogMessage {
pri, _, _ := d.parsePriority(line)
msgIdx := d.logContentIndex(line)

// Create a copy of the line so that subsequent Scans do not override the
// message
lineCopy := make([]byte, len(line[msgIdx:]))
copy(lineCopy, line[msgIdx:])

return &SyslogMessage{
Severity: pri.Severity,
Message: line[msgIdx:],
Message: lineCopy,
}
}

Expand Down

0 comments on commit fc4d489

Please sign in to comment.