Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
feat(log): add access log to TCP listener (#4625)
Browse files Browse the repository at this point in the history
Add Envoy access log configuration to inbound & outbound
listener for TCP traffic.

Signed-off-by: Allen Leigh <[email protected]>
  • Loading branch information
allenlsy authored Mar 31, 2022
1 parent d1100a8 commit bd7e61d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/envoy/lds/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (lb *listenerBuilder) newOutboundListener() (*xds_listener.Listener, error)
Name: wellknown.OriginalDestination,
},
},
AccessLog: envoy.GetAccessLog(),
}

// Create a default passthrough filter chain when global egress is enabled.
Expand Down Expand Up @@ -122,6 +123,7 @@ func newInboundListener() *xds_listener.Listener {
Name: wellknown.OriginalDestination,
},
},
AccessLog: envoy.GetAccessLog(),
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/envoy/lds/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var _ = Describe("Construct inbound listeners", func() {
It("Tests the inbound listener config", func() {
listener := newInboundListener()
Expect(listener.Address).To(Equal(envoy.GetAddress(constants.WildcardIPAddr, constants.EnvoyInboundListenerPort)))
Expect(listener.AccessLog).NotTo(BeEmpty())
Expect(len(listener.ListenerFilters)).To(Equal(2)) // TlsInspector, OriginalDestination listener filter
Expect(listener.ListenerFilters[0].Name).To(Equal(wellknown.TlsInspector))
Expect(listener.TrafficDirection).To(Equal(xds_core.TrafficDirection_INBOUND))
Expand Down Expand Up @@ -202,6 +203,7 @@ func TestNewOutboundListener(t *testing.T) {
assert.NoError(err)

assert.Len(listener.ListenerFilters, 3) // OriginalDst, TlsInspector, HttpInspector
assert.NotEmpty(listener.AccessLog)
assert.Equal(wellknown.TlsInspector, listener.ListenerFilters[1].Name)
assert.Equal(&xds_listener.ListenerFilterChainMatchPredicate{
Rule: &xds_listener.ListenerFilterChainMatchPredicate_DestinationPortRange{
Expand Down

0 comments on commit bd7e61d

Please sign in to comment.