Skip to content

Commit

Permalink
fix(data-planes) access log missing new line
Browse files Browse the repository at this point in the history
With the TrafficLog policy, using a custom format with the `type: file` makes the
data-planes concatenate all the Access Logs until a new Log is
generated. This bug is not observed when omiting the format.
This is fixed by addind a new line after each Access Log.
For more informations see #820
  • Loading branch information
xbauquet committed Jun 15, 2020
1 parent a2b6f79 commit 3eb51b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/kuma-dp/pkg/dataplane/accesslogs/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *sender) Connect() error {
}

func (s *sender) Send(record string) error {
_, err := s.conn.Write(append([]byte(record), byte('\n')))
_, err := s.conn.Write([]byte(record))
return errors.Wrapf(err, "failed to send a log entry to a TCP logging backend: %s", s.address)
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/xds/envoy/listeners/access_log_configurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func convertLoggingBackend(mesh string, trafficDirection TrafficDirection, sourc
if backend.Format != "" {
formatString = backend.Format
}
format, err := accesslog.ParseFormat(formatString)

format, err := accesslog.ParseFormat(formatString + "\n")
if err != nil {
return nil, errors.Wrapf(err, "invalid access log format string: %s", formatString)
}
Expand Down

0 comments on commit 3eb51b7

Please sign in to comment.