Skip to content

Commit

Permalink
Adding newline to cluster text log format (#46)
Browse files Browse the repository at this point in the history
This is needed to separate the cluster log lines.
  • Loading branch information
dinofizz authored Jan 10, 2025
1 parent a1c0c3c commit 969fc57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion controllers/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var (
)

const (
ClusterTextLogFormat = "[%START_TIME%] %BYTES_RECEIVED% %BYTES_SENT% %DURATION% \"%DOWNSTREAM_REMOTE_ADDRESS%\" \"%UPSTREAM_HOST%\" \"%UPSTREAM_CLUSTER%\""
ClusterTextLogFormat = "[%START_TIME%] %BYTES_RECEIVED% %BYTES_SENT% %DURATION% \"%DOWNSTREAM_REMOTE_ADDRESS%\" \"%UPSTREAM_HOST%\" \"%UPSTREAM_CLUSTER%\"\n"
AdminTextLogFormat = "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\"\n"
)

Expand Down
10 changes: 5 additions & 5 deletions controllers/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ staticResources:
contentType: application/json; charset=UTF-8
omitEmptyValues: true
textFormatSource:
inlineString: '[%START_TIME%] %BYTES_RECEIVED% %BYTES_SENT% %DURATION%
"%DOWNSTREAM_REMOTE_ADDRESS%" "%UPSTREAM_HOST%" "%UPSTREAM_CLUSTER%"'
inlineString: |
[%START_TIME%] %BYTES_RECEIVED% %BYTES_SENT% %DURATION% "%DOWNSTREAM_REMOTE_ADDRESS%" "%UPSTREAM_HOST%" "%UPSTREAM_CLUSTER%"
cluster: foo_UDP_100
statPrefix: udp_proxy
name: foo_UDP_100
Expand All @@ -123,8 +123,8 @@ staticResources:
contentType: application/json; charset=UTF-8
omitEmptyValues: true
textFormatSource:
inlineString: '[%START_TIME%] %BYTES_RECEIVED% %BYTES_SENT% %DURATION%
"%DOWNSTREAM_REMOTE_ADDRESS%" "%UPSTREAM_HOST%" "%UPSTREAM_CLUSTER%"'
inlineString: |
[%START_TIME%] %BYTES_RECEIVED% %BYTES_SENT% %DURATION% "%DOWNSTREAM_REMOTE_ADDRESS%" "%UPSTREAM_HOST%" "%UPSTREAM_CLUSTER%"
cluster: foo_TCP_101
statPrefix: tcp_proxy
name: foo_TCP_101
Expand Down Expand Up @@ -354,7 +354,7 @@ staticResources:
t.Error(err)
}
if got != tt.want {
t.Errorf("envoyConfig() = %v, want %v", got, tt.want)
t.Errorf("got:\n%v, want:\n%v", got, tt.want)
t.Error(cmp.Diff(got, tt.want))
}
})
Expand Down

0 comments on commit 969fc57

Please sign in to comment.