diff --git a/cmd/contour/serve.go b/cmd/contour/serve.go
index 403b7a39433..7d6260f7fc0 100644
--- a/cmd/contour/serve.go
+++ b/cmd/contour/serve.go
@@ -297,6 +297,8 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error {
HTTPSAccessLog: ctx.httpsAccessLog,
AccessLogType: ctx.Config.AccessLogFormat,
AccessLogFields: ctx.Config.AccessLogFields,
+ AccessLogFormatString: ctx.Config.AccessLogFormatString,
+ AccessLogFormatterExtensions: ctx.Config.AccessLogFormatterExtensions(),
MinimumTLSVersion: annotation.MinTLSVersion(ctx.Config.TLS.MinimumProtocolVersion, "1.2"),
CipherSuites: config.SanitizeCipherSuites(ctx.Config.TLS.CipherSuites),
RequestTimeout: requestTimeout,
diff --git a/examples/contour/01-contour-config.yaml b/examples/contour/01-contour-config.yaml
index ee2989f79dd..dcf05dfff24 100644
--- a/examples/contour/01-contour-config.yaml
+++ b/examples/contour/01-contour-config.yaml
@@ -61,6 +61,8 @@ data:
### Logging options
# Default setting
accesslog-format: envoy
+ # The default access log format is defined by Envoy but it can be customized by setting following variable.
+ # accesslog-format-string: "...\n"
# To enable JSON logging in Envoy
# accesslog-format: json
# The default fields that will be logged are specified below.
diff --git a/examples/render/contour-gateway.yaml b/examples/render/contour-gateway.yaml
index e40ebe7c2be..121905283a7 100644
--- a/examples/render/contour-gateway.yaml
+++ b/examples/render/contour-gateway.yaml
@@ -98,6 +98,8 @@ data:
### Logging options
# Default setting
accesslog-format: envoy
+ # The default access log format is defined by Envoy but it can be customized by setting following variable.
+ # accesslog-format-string: "...\n"
# To enable JSON logging in Envoy
# accesslog-format: json
# The default fields that will be logged are specified below.
diff --git a/examples/render/contour.yaml b/examples/render/contour.yaml
index 04d68e729d7..cc44bc63699 100644
--- a/examples/render/contour.yaml
+++ b/examples/render/contour.yaml
@@ -95,6 +95,8 @@ data:
### Logging options
# Default setting
accesslog-format: envoy
+ # The default access log format is defined by Envoy but it can be customized by setting following variable.
+ # accesslog-format-string: "...\n"
# To enable JSON logging in Envoy
# accesslog-format: json
# The default fields that will be logged are specified below.
diff --git a/go.mod b/go.mod
index c8f7d444e5c..5ae24ad0773 100644
--- a/go.mod
+++ b/go.mod
@@ -5,8 +5,8 @@ go 1.15
require (
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0
github.com/bombsimon/logrusr v1.0.0
- github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/envoyproxy/go-control-plane v0.9.9-0.20210111201334-f1f47757da33
+ github.com/davecgh/go-spew v1.1.1
+ github.com/envoyproxy/go-control-plane v0.9.10-0.20210614203518-782de910ff04
github.com/go-logr/logr v0.4.0
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5
@@ -21,7 +21,7 @@ require (
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.7.0
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a
- google.golang.org/grpc v1.27.1
+ google.golang.org/grpc v1.36.0
google.golang.org/protobuf v1.26.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.4.0
diff --git a/go.sum b/go.sum
index 143fab804c1..4b305b06194 100644
--- a/go.sum
+++ b/go.sum
@@ -77,6 +77,7 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
+github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
@@ -106,8 +107,10 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/cloudflare-go v0.13.2/go.mod h1:27kfc1apuifUmJhp069y0+hwlKDg4bd8LWlu7oKeZvM=
-github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403 h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M=
+github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed h1:OZmjad4L3H8ncOIR8rnb5MREYqG8ixi5+WbeUsquF0c=
+github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -148,8 +151,10 @@ github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
-github.com/envoyproxy/go-control-plane v0.9.9-0.20210111201334-f1f47757da33 h1:U16cYLyGghDDNddBIk9+PwCIwkyqGnt+W29t8JmYfnk=
-github.com/envoyproxy/go-control-plane v0.9.9-0.20210111201334-f1f47757da33/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.10-0.20210614203518-782de910ff04 h1:Tf/fkJiR5CnKHqyr+qwRGhnimnWnM6J6tIfjUc9k3L0=
+github.com/envoyproxy/go-control-plane v0.9.10-0.20210614203518-782de910ff04/go.mod h1:+baROYa9cKpDyN21rZlsSq5zgBrZOrMTNu78Lm3fFJQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
@@ -255,7 +260,6 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
-github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -340,6 +344,7 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -546,6 +551,7 @@ github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3x
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
@@ -626,6 +632,7 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
@@ -929,6 +936,7 @@ google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a h1:pOwg4OoaRYScjmR4LlLgdtnyoHYTSAVhhqe5uPdpII8=
@@ -944,8 +952,10 @@ google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
-google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
+google.golang.org/grpc v1.36.0 h1:o1bcQ6imQMIOpdrO3SWf2z5RV72WbDwdXuK0MDlc8As=
+google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -984,6 +994,7 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
gopkg.in/yaml.v2 v2.0.0/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/internal/envoy/v3/accesslog.go b/internal/envoy/v3/accesslog.go
index b0fcf8dc75a..3b308ea953b 100644
--- a/internal/envoy/v3/accesslog.go
+++ b/internal/envoy/v3/accesslog.go
@@ -17,6 +17,7 @@ import (
envoy_accesslog_v3 "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3"
envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
envoy_file_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3"
+ envoy_req_without_query_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/req_without_query/v3"
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
_struct "github.com/golang/protobuf/ptypes/struct"
"github.com/projectcontour/contour/internal/protobuf"
@@ -24,14 +25,31 @@ import (
)
// FileAccessLogEnvoy returns a new file based access log filter
-// that will output Envoy's default access logs.
-func FileAccessLogEnvoy(path string) []*envoy_accesslog_v3.AccessLog {
+func FileAccessLogEnvoy(path string, format string, extensions []string) []*envoy_accesslog_v3.AccessLog {
+ // Nil by default to defer to Envoy's default log format.
+ var logFormat *envoy_file_v3.FileAccessLog_LogFormat
+
+ if format != "" {
+ logFormat = &envoy_file_v3.FileAccessLog_LogFormat{
+ LogFormat: &envoy_config_core_v3.SubstitutionFormatString{
+ Format: &envoy_config_core_v3.SubstitutionFormatString_TextFormatSource{
+ TextFormatSource: &envoy_config_core_v3.DataSource{
+ Specifier: &envoy_config_core_v3.DataSource_InlineString{
+ InlineString: format,
+ },
+ },
+ },
+ Formatters: extensionConfig(extensions),
+ },
+ }
+ }
+
return []*envoy_accesslog_v3.AccessLog{{
Name: wellknown.FileAccessLog,
ConfigType: &envoy_accesslog_v3.AccessLog_TypedConfig{
TypedConfig: protobuf.MustMarshalAny(&envoy_file_v3.FileAccessLog{
- Path: path,
- // AccessLogFormat left blank to defer to Envoy's default log format.
+ Path: path,
+ AccessLogFormat: logFormat,
}),
},
}}
@@ -39,7 +57,7 @@ func FileAccessLogEnvoy(path string) []*envoy_accesslog_v3.AccessLog {
// FileAccessLogJSON returns a new file based access log filter
// that will log in JSON format
-func FileAccessLogJSON(path string, fields config.AccessLogFields) []*envoy_accesslog_v3.AccessLog {
+func FileAccessLogJSON(path string, fields config.AccessLogFields, extensions []string) []*envoy_accesslog_v3.AccessLog {
jsonformat := &_struct.Struct{
Fields: make(map[string]*_struct.Value),
@@ -59,6 +77,7 @@ func FileAccessLogJSON(path string, fields config.AccessLogFields) []*envoy_acce
Format: &envoy_config_core_v3.SubstitutionFormatString_JsonFormat{
JsonFormat: jsonformat,
},
+ Formatters: extensionConfig(extensions),
},
},
}),
@@ -73,3 +92,23 @@ func sv(s string) *_struct.Value {
},
}
}
+
+// extensionConfig returns a list of extension configs required by the access log format.
+//
+// Note: When adding support for new formatter, update the list of extensions here and
+// add the corresponding extension in pkg/config/parameters.go AccessLogFormatterExtensions().
+// Currently only one extension exist in Envoy.
+func extensionConfig(extensions []string) []*envoy_config_core_v3.TypedExtensionConfig {
+ var config []*envoy_config_core_v3.TypedExtensionConfig
+
+ for _, e := range extensions {
+ if e == "envoy.formatter.req_without_query" {
+ config = append(config, &envoy_config_core_v3.TypedExtensionConfig{
+ Name: "envoy.formatter.req_without_query",
+ TypedConfig: protobuf.MustMarshalAny(&envoy_req_without_query_v3.ReqWithoutQuery{ /* empty */ }),
+ })
+ }
+ }
+
+ return config
+}
diff --git a/internal/envoy/v3/accesslog_test.go b/internal/envoy/v3/accesslog_test.go
index 3d2a8bd038a..70120e36b35 100644
--- a/internal/envoy/v3/accesslog_test.go
+++ b/internal/envoy/v3/accesslog_test.go
@@ -19,6 +19,7 @@ import (
envoy_accesslog_v3 "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3"
envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
envoy_file_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3"
+ envoy_req_without_query_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/req_without_query/v3"
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
_struct "github.com/golang/protobuf/ptypes/struct"
"github.com/projectcontour/contour/internal/protobuf"
@@ -27,8 +28,10 @@ import (
func TestFileAccessLog(t *testing.T) {
tests := map[string]struct {
- path string
- want []*envoy_accesslog_v3.AccessLog
+ path string
+ format string
+ extensions []string
+ want []*envoy_accesslog_v3.AccessLog
}{
"stdout": {
path: "/dev/stdout",
@@ -41,10 +44,61 @@ func TestFileAccessLog(t *testing.T) {
},
}},
},
+ "custom log format": {
+ path: "/dev/stdout",
+ format: "%START_TIME%\n",
+ want: []*envoy_accesslog_v3.AccessLog{{
+ Name: wellknown.FileAccessLog,
+ ConfigType: &envoy_accesslog_v3.AccessLog_TypedConfig{
+ TypedConfig: protobuf.MustMarshalAny(&envoy_file_v3.FileAccessLog{
+ Path: "/dev/stdout",
+ AccessLogFormat: &envoy_file_v3.FileAccessLog_LogFormat{
+ LogFormat: &envoy_config_core_v3.SubstitutionFormatString{
+ Format: &envoy_config_core_v3.SubstitutionFormatString_TextFormatSource{
+ TextFormatSource: &envoy_config_core_v3.DataSource{
+ Specifier: &envoy_config_core_v3.DataSource_InlineString{
+ InlineString: "%START_TIME%\n",
+ },
+ },
+ },
+ },
+ },
+ }),
+ },
+ }},
+ },
+ "custom log format with access log extension": {
+ path: "/dev/stdout",
+ format: "[%START_TIME%] \"%REQ_WITHOUT_QUERY(X-ENVOY-ORIGINAL-PATH?:PATH)%\"\n",
+ extensions: []string{"envoy.formatter.req_without_query"},
+ want: []*envoy_accesslog_v3.AccessLog{{
+ Name: wellknown.FileAccessLog,
+ ConfigType: &envoy_accesslog_v3.AccessLog_TypedConfig{
+ TypedConfig: protobuf.MustMarshalAny(&envoy_file_v3.FileAccessLog{
+ Path: "/dev/stdout",
+ AccessLogFormat: &envoy_file_v3.FileAccessLog_LogFormat{
+ LogFormat: &envoy_config_core_v3.SubstitutionFormatString{
+ Format: &envoy_config_core_v3.SubstitutionFormatString_TextFormatSource{
+ TextFormatSource: &envoy_config_core_v3.DataSource{
+ Specifier: &envoy_config_core_v3.DataSource_InlineString{
+ InlineString: "[%START_TIME%] \"%REQ_WITHOUT_QUERY(X-ENVOY-ORIGINAL-PATH?:PATH)%\"\n",
+ },
+ },
+ },
+ Formatters: []*envoy_config_core_v3.TypedExtensionConfig{{
+ Name: "envoy.formatter.req_without_query",
+ TypedConfig: protobuf.MustMarshalAny(&envoy_req_without_query_v3.ReqWithoutQuery{ /* empty */ }),
+ }},
+ },
+ },
+ }),
+ },
+ }},
+ },
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
- got := FileAccessLogEnvoy(tc.path)
+ got := FileAccessLogEnvoy(tc.path, tc.format, tc.extensions)
protobuf.ExpectEqual(t, tc.want, got)
})
}
@@ -117,7 +171,7 @@ func TestJSONFileAccessLog(t *testing.T) {
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
- got := FileAccessLogJSON(tc.path, tc.headers)
+ got := FileAccessLogJSON(tc.path, tc.headers, nil)
protobuf.ExpectEqual(t, tc.want, got)
})
}
diff --git a/internal/envoy/v3/listener_test.go b/internal/envoy/v3/listener_test.go
index c309c66ff6d..8ad0a18507b 100644
--- a/internal/envoy/v3/listener_test.go
+++ b/internal/envoy/v3/listener_test.go
@@ -67,13 +67,13 @@ func TestListener(t *testing.T) {
address: "0.0.0.0",
port: 9000,
f: []*envoy_listener_v3.Filter{
- HTTPConnectionManager("http", FileAccessLogEnvoy("/dev/null"), 0, 0),
+ HTTPConnectionManager("http", FileAccessLogEnvoy("/dev/null", "", nil), 0, 0),
},
want: &envoy_listener_v3.Listener{
Name: "http",
Address: SocketAddress("0.0.0.0", 9000),
FilterChains: FilterChains(
- HTTPConnectionManager("http", FileAccessLogEnvoy("/dev/null"), 0, 0),
+ HTTPConnectionManager("http", FileAccessLogEnvoy("/dev/null", "", nil), 0, 0),
),
SocketOptions: TCPKeepaliveSocketOptions(),
},
@@ -86,7 +86,7 @@ func TestListener(t *testing.T) {
ProxyProtocol(),
},
f: []*envoy_listener_v3.Filter{
- HTTPConnectionManager("http-proxy", FileAccessLogEnvoy("/dev/null"), 0, 0),
+ HTTPConnectionManager("http-proxy", FileAccessLogEnvoy("/dev/null", "", nil), 0, 0),
},
want: &envoy_listener_v3.Listener{
Name: "http-proxy",
@@ -95,7 +95,7 @@ func TestListener(t *testing.T) {
ProxyProtocol(),
),
FilterChains: FilterChains(
- HTTPConnectionManager("http-proxy", FileAccessLogEnvoy("/dev/null"), 0, 0),
+ HTTPConnectionManager("http-proxy", FileAccessLogEnvoy("/dev/null", "", nil), 0, 0),
),
SocketOptions: TCPKeepaliveSocketOptions(),
},
@@ -389,7 +389,7 @@ func TestHTTPConnectionManager(t *testing.T) {
}{
"default": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
ConfigType: &envoy_listener_v3.Filter_TypedConfig{
@@ -465,7 +465,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -479,7 +479,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"request timeout of 10s": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
requestTimeout: timeout.DurationSetting(10 * time.Second),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -556,7 +556,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -571,7 +571,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"connection idle timeout of 90s": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
connectionIdleTimeout: timeout.DurationSetting(90 * time.Second),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -650,7 +650,7 @@ func TestHTTPConnectionManager(t *testing.T) {
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{
IdleTimeout: protobuf.Duration(90 * time.Second),
},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -664,7 +664,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"stream idle timeout of 90s": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
streamIdleTimeout: timeout.DurationSetting(90 * time.Second),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -741,7 +741,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -756,7 +756,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"max connection duration of 90s": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
maxConnectionDuration: timeout.DurationSetting(90 * time.Second),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -835,7 +835,7 @@ func TestHTTPConnectionManager(t *testing.T) {
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{
MaxConnectionDuration: protobuf.Duration(90 * time.Second),
},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -849,7 +849,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"when max connection duration is disabled, it's omitted": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
maxConnectionDuration: timeout.DisabledSetting(),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -926,7 +926,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -940,7 +940,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"delayed close timeout of 90s": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
delayedCloseTimeout: timeout.DurationSetting(90 * time.Second),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -1017,7 +1017,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -1032,7 +1032,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"drain timeout of 90s": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
connectionShutdownGracePeriod: timeout.DurationSetting(90 * time.Second),
want: &envoy_listener_v3.Filter{
Name: wellknown.HTTPConnectionManager,
@@ -1109,7 +1109,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -1124,7 +1124,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"enable allow_chunked_length": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
connectionShutdownGracePeriod: timeout.DurationSetting(90 * time.Second),
allowChunkedLength: true,
want: &envoy_listener_v3.Filter{
@@ -1203,7 +1203,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AllowChunkedLength: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -1218,7 +1218,7 @@ func TestHTTPConnectionManager(t *testing.T) {
},
"enable XffNumTrustedHops": {
routename: "default/kuard",
- accesslogger: FileAccessLogEnvoy("/dev/stdout"),
+ accesslogger: FileAccessLogEnvoy("/dev/stdout", "", nil),
connectionShutdownGracePeriod: timeout.DurationSetting(90 * time.Second),
xffNumTrustedHops: 1,
want: &envoy_listener_v3.Filter{
@@ -1296,7 +1296,7 @@ func TestHTTPConnectionManager(t *testing.T) {
AcceptHttp_10: true,
},
CommonHttpProtocolOptions: &envoy_core_v3.HttpProtocolOptions{},
- AccessLog: FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: FileAccessLogEnvoy("/dev/stdout", "", nil),
UseRemoteAddress: protobuf.Bool(true),
NormalizePath: protobuf.Bool(true),
StripPortMode: &http.HttpConnectionManager_StripAnyHostPort{
@@ -1384,7 +1384,7 @@ func TestTCPProxy(t *testing.T) {
ClusterSpecifier: &envoy_tcp_proxy_v3.TcpProxy_Cluster{
Cluster: envoy.Clustername(c1),
},
- AccessLog: FileAccessLogEnvoy(accessLogPath),
+ AccessLog: FileAccessLogEnvoy(accessLogPath, "", nil),
IdleTimeout: protobuf.Duration(9001 * time.Second),
}),
},
@@ -1410,7 +1410,7 @@ func TestTCPProxy(t *testing.T) {
}},
},
},
- AccessLog: FileAccessLogEnvoy(accessLogPath),
+ AccessLog: FileAccessLogEnvoy(accessLogPath, "", nil),
IdleTimeout: protobuf.Duration(9001 * time.Second),
}),
},
@@ -1420,7 +1420,7 @@ func TestTCPProxy(t *testing.T) {
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
- got := TCPProxy(statPrefix, tc.proxy, FileAccessLogEnvoy(accessLogPath))
+ got := TCPProxy(statPrefix, tc.proxy, FileAccessLogEnvoy(accessLogPath, "", nil))
protobuf.ExpectEqual(t, tc.want, got)
})
}
diff --git a/internal/featuretests/v3/envoy.go b/internal/featuretests/v3/envoy.go
index d59b61b3f0f..b9691632f51 100644
--- a/internal/featuretests/v3/envoy.go
+++ b/internal/featuretests/v3/envoy.go
@@ -354,7 +354,7 @@ func filterchaintlsfallback(fallbackSecret *v1.Secret, peerValidationContext *da
DefaultFilters().
RouteConfigName(xdscache_v3.ENVOY_FALLBACK_ROUTECONFIG).
MetricsPrefix(xdscache_v3.ENVOY_HTTPS_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil)).
Get(),
),
)
@@ -366,7 +366,7 @@ func httpsFilterFor(vhost string) *envoy_listener_v3.Filter {
DefaultFilters().
RouteConfigName(path.Join("https", vhost)).
MetricsPrefix(xdscache_v3.ENVOY_HTTPS_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil)).
Get()
}
@@ -388,7 +388,7 @@ func authzFilterFor(
}).
RouteConfigName(path.Join("https", vhost)).
MetricsPrefix(xdscache_v3.ENVOY_HTTPS_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil)).
Get()
}
@@ -401,7 +401,7 @@ func tcpproxy(statPrefix, cluster string) *envoy_listener_v3.Filter {
ClusterSpecifier: &envoy_tcp_proxy_v3.TcpProxy_Cluster{
Cluster: cluster,
},
- AccessLog: envoy_v3.FileAccessLogEnvoy("/dev/stdout"),
+ AccessLog: envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil),
IdleTimeout: protobuf.Duration(9001 * time.Second),
}),
},
@@ -417,7 +417,7 @@ func defaultHTTPListener() *envoy_listener_v3.Listener {
Name: "ingress_http",
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
FilterChains: envoy_v3.FilterChains(
- envoy_v3.HTTPConnectionManager("ingress_http", envoy_v3.FileAccessLogEnvoy("/dev/stdout"), 0, 0),
+ envoy_v3.HTTPConnectionManager("ingress_http", envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil), 0, 0),
),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}
diff --git a/internal/featuretests/v3/globalratelimit_test.go b/internal/featuretests/v3/globalratelimit_test.go
index bd7e58bb3d1..f6b8bc42e6d 100644
--- a/internal/featuretests/v3/globalratelimit_test.go
+++ b/internal/featuretests/v3/globalratelimit_test.go
@@ -69,7 +69,7 @@ func globalRateLimitFilterExists(t *testing.T, rh cache.ResourceEventHandler, c
hcm := envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName("ingress_http").
MetricsPrefix("ingress_http").
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil)).
DefaultFilters().
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
diff --git a/internal/featuretests/v3/listeners_test.go b/internal/featuretests/v3/listeners_test.go
index 40103e4330d..98f5aefcd93 100644
--- a/internal/featuretests/v3/listeners_test.go
+++ b/internal/featuretests/v3/listeners_test.go
@@ -888,7 +888,7 @@ func TestLDSCustomAccessLogPaths(t *testing.T) {
httpListener := defaultHTTPListener()
httpListener.FilterChains = envoy_v3.FilterChains(
- envoy_v3.HTTPConnectionManager("ingress_http", envoy_v3.FileAccessLogEnvoy("/tmp/http_access.log"), 0, 0),
+ envoy_v3.HTTPConnectionManager("ingress_http", envoy_v3.FileAccessLogEnvoy("/tmp/http_access.log", "", nil), 0, 0),
)
httpsListener := &envoy_listener_v3.Listener{
@@ -904,7 +904,7 @@ func TestLDSCustomAccessLogPaths(t *testing.T) {
DefaultFilters().
RouteConfigName("https/kuard.example.com").
MetricsPrefix(xdscache_v3.ENVOY_HTTPS_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/tmp/https_access.log")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/tmp/https_access.log", "", nil)).
Get(),
nil, "h2", "http/1.1"),
},
@@ -1242,7 +1242,7 @@ func TestHTTPProxyXffNumTrustedHops(t *testing.T) {
// verify that the xff-num-trusted-hops have been set to 1.
httpListener := defaultHTTPListener()
- httpListener.FilterChains = envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager("ingress_http", envoy_v3.FileAccessLogEnvoy("/dev/stdout"), 0, 1))
+ httpListener.FilterChains = envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager("ingress_http", envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil), 0, 1))
c.Request(listenerType).Equals(&envoy_discovery_v3.DiscoveryResponse{
Resources: resources(t,
diff --git a/internal/featuretests/v3/timeouts_test.go b/internal/featuretests/v3/timeouts_test.go
index 36e744e7e7c..6567068c47b 100644
--- a/internal/featuretests/v3/timeouts_test.go
+++ b/internal/featuretests/v3/timeouts_test.go
@@ -61,7 +61,7 @@ func TestTimeoutsNotSpecified(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(xdscache_v3.ENVOY_HTTP_LISTENER).
MetricsPrefix(xdscache_v3.ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(xdscache_v3.DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(xdscache_v3.DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
Get(),
)
@@ -113,7 +113,7 @@ func TestNonZeroTimeoutsSpecified(t *testing.T) {
httpListener.FilterChains = envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(xdscache_v3.ENVOY_HTTP_LISTENER).
MetricsPrefix(xdscache_v3.ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(xdscache_v3.DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(xdscache_v3.DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionIdleTimeout(timeout.DurationSetting(7 * time.Second)).
StreamIdleTimeout(timeout.DurationSetting(70 * time.Second)).
diff --git a/internal/xdscache/v3/listener.go b/internal/xdscache/v3/listener.go
index ac529a28219..12203265c94 100644
--- a/internal/xdscache/v3/listener.go
+++ b/internal/xdscache/v3/listener.go
@@ -103,6 +103,13 @@ type ListenerConfig struct {
// Defaults to a particular set of fields.
AccessLogFields config.AccessLogFields
+ // AccessLogFormatString sets the format string to be used for text based access logs.
+ // Defaults to empty to defer to Envoy's default log format.
+ AccessLogFormatString string
+
+ // AccessLogFormatterExtensions defines the Envoy extensions to enable for access log.
+ AccessLogFormatterExtensions []string
+
// RequestTimeout configures the request_timeout for all Connection Managers.
RequestTimeout timeout.Setting
@@ -245,18 +252,18 @@ func (lvc *ListenerConfig) accesslogFields() config.AccessLogFields {
func (lvc *ListenerConfig) newInsecureAccessLog() []*envoy_accesslog_v3.AccessLog {
switch lvc.accesslogType() {
case string(config.JSONAccessLog):
- return envoy_v3.FileAccessLogJSON(lvc.httpAccessLog(), lvc.accesslogFields())
+ return envoy_v3.FileAccessLogJSON(lvc.httpAccessLog(), lvc.accesslogFields(), lvc.AccessLogFormatterExtensions)
default:
- return envoy_v3.FileAccessLogEnvoy(lvc.httpAccessLog())
+ return envoy_v3.FileAccessLogEnvoy(lvc.httpAccessLog(), lvc.AccessLogFormatString, lvc.AccessLogFormatterExtensions)
}
}
func (lvc *ListenerConfig) newSecureAccessLog() []*envoy_accesslog_v3.AccessLog {
switch lvc.accesslogType() {
case "json":
- return envoy_v3.FileAccessLogJSON(lvc.httpsAccessLog(), lvc.accesslogFields())
+ return envoy_v3.FileAccessLogJSON(lvc.httpsAccessLog(), lvc.accesslogFields(), lvc.AccessLogFormatterExtensions)
default:
- return envoy_v3.FileAccessLogEnvoy(lvc.httpsAccessLog())
+ return envoy_v3.FileAccessLogEnvoy(lvc.httpsAccessLog(), lvc.AccessLogFormatString, lvc.AccessLogFormatterExtensions)
}
}
diff --git a/internal/xdscache/v3/listener_test.go b/internal/xdscache/v3/listener_test.go
index b61fd713a32..3794a9bb804 100644
--- a/internal/xdscache/v3/listener_test.go
+++ b/internal/xdscache/v3/listener_test.go
@@ -51,14 +51,14 @@ func TestListenerCacheContents(t *testing.T) {
contents: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
want: []proto.Message{
&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
},
},
@@ -85,7 +85,7 @@ func TestListenerCacheQuery(t *testing.T) {
contents: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
query: []string{ENVOY_HTTP_LISTENER},
@@ -93,7 +93,7 @@ func TestListenerCacheQuery(t *testing.T) {
&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
},
},
@@ -102,7 +102,7 @@ func TestListenerCacheQuery(t *testing.T) {
contents: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
query: []string{ENVOY_HTTP_LISTENER, "stats-listener"},
@@ -110,7 +110,7 @@ func TestListenerCacheQuery(t *testing.T) {
&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
},
},
@@ -119,7 +119,7 @@ func TestListenerCacheQuery(t *testing.T) {
contents: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
query: []string{"stats-listener"},
@@ -144,7 +144,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", vhost)).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
Get()
}
@@ -152,7 +152,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
Get()
tests := map[string]struct {
@@ -193,7 +193,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
},
@@ -236,7 +236,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
},
@@ -289,7 +289,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -378,7 +378,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -451,7 +451,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}),
},
@@ -502,7 +502,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -667,7 +667,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("127.0.0.100", 9100),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -740,7 +740,7 @@ func TestListenerVisit(t *testing.T) {
ListenerFilters: envoy_v3.ListenerFilters(
envoy_v3.ProxyProtocol(),
),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -812,7 +812,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress(DEFAULT_HTTP_LISTENER_ADDRESS, DEFAULT_HTTP_LISTENER_PORT),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy("/tmp/http_access.log"), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy("/tmp/http_access.log", "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -830,7 +830,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "whatever.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/tmp/https_access.log")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/tmp/https_access.log", "", nil)).
Get()),
}},
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
@@ -888,7 +888,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -961,7 +961,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -1030,7 +1030,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -1101,7 +1101,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -1189,7 +1189,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
RequestTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -1208,7 +1208,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
RequestTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1221,7 +1221,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
RequestTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1303,7 +1303,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -1322,7 +1322,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
ConnectionIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1335,7 +1335,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
ConnectionIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1417,7 +1417,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
StreamIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -1436,7 +1436,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
StreamIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1449,7 +1449,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
StreamIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1531,7 +1531,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
DelayedCloseTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -1550,7 +1550,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DelayedCloseTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1563,7 +1563,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DelayedCloseTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1645,7 +1645,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
MaxConnectionDuration(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -1664,7 +1664,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
MaxConnectionDuration(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1677,7 +1677,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
MaxConnectionDuration(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1759,7 +1759,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionShutdownGracePeriod(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -1778,7 +1778,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
ConnectionShutdownGracePeriod(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1791,7 +1791,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
ConnectionShutdownGracePeriod(timeout.DurationSetting(90 * time.Second)).
Get(),
),
@@ -1867,7 +1867,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -1981,7 +1981,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -2126,7 +2126,7 @@ func TestListenerVisit(t *testing.T) {
want: listenermap(&envoy_listener_v3.Listener{
Name: ENVOY_HTTP_LISTENER,
Address: envoy_v3.SocketAddress("0.0.0.0", 8080),
- FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG), 0, 0)),
+ FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManager(ENVOY_HTTP_LISTENER, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil), 0, 0)),
SocketOptions: envoy_v3.TCPKeepaliveSocketOptions(),
}, &envoy_listener_v3.Listener{
Name: ENVOY_HTTPS_LISTENER,
@@ -2190,7 +2190,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2244,7 +2244,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
StreamIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2298,7 +2298,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
MaxConnectionDuration(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2352,7 +2352,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
DelayedCloseTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2406,7 +2406,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionShutdownGracePeriod(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2467,7 +2467,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2486,7 +2486,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
ConnectionIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get()),
}},
@@ -2542,7 +2542,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
AllowChunkedLength(true).
Get(),
@@ -2596,7 +2596,7 @@ func TestListenerVisit(t *testing.T) {
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
NumTrustedHops(1).
Get(),
@@ -2657,7 +2657,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
StreamIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2676,7 +2676,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
StreamIdleTimeout(timeout.DurationSetting(90 * time.Second)).
Get()),
}},
@@ -2739,7 +2739,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
MaxConnectionDuration(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2758,7 +2758,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
MaxConnectionDuration(timeout.DurationSetting(90 * time.Second)).
Get()),
}},
@@ -2821,7 +2821,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
DelayedCloseTimeout(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2840,7 +2840,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DelayedCloseTimeout(timeout.DurationSetting(90 * time.Second)).
Get()),
}},
@@ -2903,7 +2903,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
ConnectionShutdownGracePeriod(timeout.DurationSetting(90 * time.Second)).
Get(),
@@ -2922,7 +2922,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
ConnectionShutdownGracePeriod(timeout.DurationSetting(90 * time.Second)).
Get()),
}},
@@ -2983,7 +2983,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName("ingress_http").
MetricsPrefix("ingress_http").
- AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout")).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy("/dev/stdout", "", nil)).
DefaultFilters().
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
@@ -3068,7 +3068,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
MetricsPrefix(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
@@ -3107,7 +3107,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
ConfigType: &http.HttpFilter_TypedConfig{
@@ -3213,7 +3213,7 @@ func TestListenerVisit(t *testing.T) {
FilterChains: envoy_v3.FilterChains(
envoy_v3.HTTPConnectionManagerBuilder().
RouteConfigName(ENVOY_HTTP_LISTENER).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
DefaultFilters().
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
@@ -3252,7 +3252,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(path.Join("https", "www.example.com")).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
ConfigType: &http.HttpFilter_TypedConfig{
@@ -3285,7 +3285,7 @@ func TestListenerVisit(t *testing.T) {
DefaultFilters().
MetricsPrefix(ENVOY_HTTPS_LISTENER).
RouteConfigName(ENVOY_FALLBACK_ROUTECONFIG).
- AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG)).
+ AccessLoggers(envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTP_ACCESS_LOG, "", nil)).
AddFilter(&http.HttpFilter{
Name: wellknown.HTTPRateLimit,
ConfigType: &http.HttpFilter_TypedConfig{
diff --git a/internal/xdscache/v3/visitor_test.go b/internal/xdscache/v3/visitor_test.go
index aaf41d57602..454a1d99220 100644
--- a/internal/xdscache/v3/visitor_test.go
+++ b/internal/xdscache/v3/visitor_test.go
@@ -137,7 +137,7 @@ func TestVisitListeners(t *testing.T) {
ServerNames: []string{"tcpproxy.example.com"},
},
TransportSocket: transportSocket("secret", envoy_tls_v3.TlsParameters_TLSv1_2, nil),
- Filters: envoy_v3.Filters(envoy_v3.TCPProxy(ENVOY_HTTPS_LISTENER, p1, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTPS_ACCESS_LOG))),
+ Filters: envoy_v3.Filters(envoy_v3.TCPProxy(ENVOY_HTTPS_LISTENER, p1, envoy_v3.FileAccessLogEnvoy(DEFAULT_HTTPS_ACCESS_LOG, "", nil))),
}},
ListenerFilters: envoy_v3.ListenerFilters(
envoy_v3.TLSInspector(),
diff --git a/pkg/config/accesslog.go b/pkg/config/accesslog.go
index 2bf055446ee..1d71852e58e 100644
--- a/pkg/config/accesslog.go
+++ b/pkg/config/accesslog.go
@@ -108,8 +108,9 @@ var envoySimpleOperators = map[string]struct{}{
// envoyComplexOperators is the list of known Envoy log template keywords that require
// arguments.
var envoyComplexOperators = map[string]struct{}{
- "REQ": {},
- "RESP": {},
- "START_TIME": {},
- "TRAILER": {},
+ "REQ": {},
+ "RESP": {},
+ "START_TIME": {},
+ "TRAILER": {},
+ "REQ_WITHOUT_QUERY": {},
}
diff --git a/pkg/config/parameters.go b/pkg/config/parameters.go
index c207afc3532..7fc1ba363af 100644
--- a/pkg/config/parameters.go
+++ b/pkg/config/parameters.go
@@ -127,15 +127,6 @@ const JSONAccessLog AccessLogType = "json"
type AccessLogFields []string
func (a AccessLogFields) Validate() error {
- // Capture Groups:
- // Given string "the start time is %START_TIME(%s):3% wow!"
- //
- // 0. Whole match "%START_TIME(%s):3%"
- // 1. Full operator: "START_TIME(%s):3%"
- // 2. Operator Name: "START_TIME"
- // 3. Arguments: "(%s)"
- // 4. Truncation length: ":3"
- re := regexp.MustCompile(`%(([A-Z_]+)(\([^)]+\)(:[0-9]+)?)?%)?`)
for key, val := range a.AsFieldMap() {
if val == "" {
@@ -146,33 +137,9 @@ func (a AccessLogFields) Validate() error {
continue
}
- // FindAllStringSubmatch will always return a slice with matches where every slice is a slice
- // of submatches with length of 5 (number of capture groups + 1).
- tokens := re.FindAllStringSubmatch(val, -1)
- if len(tokens) == 0 {
- continue
- }
-
- for _, f := range tokens {
- op := f[2]
- if op == "" {
- return fmt.Errorf("invalid JSON field: %s, invalid Envoy format: %s", val, f)
- }
-
- _, okSimple := envoySimpleOperators[op]
- _, okComplex := envoyComplexOperators[op]
- if !okSimple && !okComplex {
- return fmt.Errorf("invalid JSON field: %s, invalid Envoy format: %s, invalid Envoy operator: %s", val, f, op)
- }
-
- if (op == "REQ" || op == "RESP" || op == "TRAILER") && f[3] == "" {
- return fmt.Errorf("invalid JSON field: %s, invalid Envoy format: %s, arguments required for operator: %s", val, f, op)
- }
-
- // START_TIME cannot not have truncation length.
- if op == "START_TIME" && f[4] != "" {
- return fmt.Errorf("invalid JSON field: %s, invalid Envoy format: %s, operator %s cannot have truncation length", val, f, op)
- }
+ err := parseAccessLogFormat(val)
+ if err != nil {
+ return fmt.Errorf("invalid JSON field: %s", err)
}
}
@@ -208,6 +175,106 @@ func (a AccessLogFields) AsFieldMap() map[string]string {
return fieldMap
}
+func validateAccessLogFormatString(format string) error {
+ // Empty format means use default format, defined by Envoy.
+ if format == "" {
+ return nil
+ }
+ err := parseAccessLogFormat(format)
+ if err != nil {
+ return fmt.Errorf("invalid access log format: %s", err)
+ }
+ if !strings.HasSuffix(format, "\n") {
+ return fmt.Errorf("invalid access log format: must end in newline")
+ }
+ return nil
+}
+
+// commandOperatorRegexp parses the command operators used in Envoy access log configuration
+//
+// Capture Groups:
+// Given string "the start time is %START_TIME(%s):3% wow!"
+//
+// 0. Whole match "%START_TIME(%s):3%"
+// 1. Full operator: "START_TIME(%s):3%"
+// 2. Operator Name: "START_TIME"
+// 3. Arguments: "(%s)"
+// 4. Truncation length: ":3"
+var commandOperatorRegexp = regexp.MustCompile(`%(([A-Z_]+)(\([^)]+\)(:[0-9]+)?)?%)?`)
+
+func parseAccessLogFormat(format string) error {
+
+ // FindAllStringSubmatch will always return a slice with matches where every slice is a slice
+ // of submatches with length of 5 (number of capture groups + 1).
+ tokens := commandOperatorRegexp.FindAllStringSubmatch(format, -1)
+ if len(tokens) == 0 {
+ return nil
+ }
+
+ for _, f := range tokens {
+ op := f[2]
+ if op == "" {
+ return fmt.Errorf("invalid Envoy format: %s", f)
+ }
+
+ _, okSimple := envoySimpleOperators[op]
+ _, okComplex := envoyComplexOperators[op]
+ if !okSimple && !okComplex {
+ return fmt.Errorf("invalid Envoy format: %s, invalid Envoy operator: %s", f, op)
+ }
+
+ if (op == "REQ" || op == "RESP" || op == "TRAILER" || op == "REQ_WITHOUT_QUERY") && f[3] == "" {
+ return fmt.Errorf("invalid Envoy format: %s, arguments required for operator: %s", f, op)
+ }
+
+ // START_TIME cannot not have truncation length.
+ if op == "START_TIME" && f[4] != "" {
+ return fmt.Errorf("invalid Envoy format: %s, operator %s cannot have truncation length", f, op)
+ }
+ }
+
+ return nil
+}
+
+// AccessLogFormatterExtensions returns a list of formatter extension names required by the access log format.
+//
+// Note: When adding support for new formatter, update the list of extensions here and
+// add corresponding configuration in internal/envoy/v3/accesslog.go extensionConfig().
+// Currently only one extension exist in Envoy.
+func (p Parameters) AccessLogFormatterExtensions() []string {
+ // Function that finds out if command operator is present in a format string.
+ contains := func(format, command string) bool {
+ tokens := commandOperatorRegexp.FindAllStringSubmatch(format, -1)
+ for _, t := range tokens {
+ if t[2] == command {
+ return true
+ }
+ }
+ return false
+ }
+
+ extensionsMap := make(map[string]bool)
+ switch p.AccessLogFormat {
+ case EnvoyAccessLog:
+ if contains(p.AccessLogFormatString, "REQ_WITHOUT_QUERY") {
+ extensionsMap["envoy.formatter.req_without_query"] = true
+ }
+ case JSONAccessLog:
+ for _, f := range p.AccessLogFields.AsFieldMap() {
+ if contains(f, "REQ_WITHOUT_QUERY") {
+ extensionsMap["envoy.formatter.req_without_query"] = true
+ }
+ }
+ }
+
+ var extensions []string
+ for k := range extensionsMap {
+ extensions = append(extensions, k)
+ }
+
+ return extensions
+}
+
// HTTPVersionType is the name of a supported HTTP version.
type HTTPVersionType string
@@ -517,6 +584,10 @@ type Parameters struct {
// Valid options are 'envoy' or 'json'
AccessLogFormat AccessLogType `yaml:"accesslog-format,omitempty"`
+ // AccessLogFormatString sets the access log format when format is set to `envoy`.
+ // When empty, Envoy's default format is used.
+ AccessLogFormatString string `yaml:"accesslog-format-string,omitempty"`
+
// AccessLogFields sets the fields that JSON logging will
// output when AccessLogFormat is json.
AccessLogFields AccessLogFields `yaml:"json-fields,omitempty"`
@@ -624,6 +695,10 @@ func (p *Parameters) Validate() error {
return err
}
+ if err := validateAccessLogFormatString(p.AccessLogFormatString); err != nil {
+ return err
+ }
+
if err := p.TLS.Validate(); err != nil {
return err
}
diff --git a/pkg/config/parameters_test.go b/pkg/config/parameters_test.go
index 51852b8abe1..ca0ebe4bec3 100644
--- a/pkg/config/parameters_test.go
+++ b/pkg/config/parameters_test.go
@@ -214,6 +214,7 @@ func TestValidateAccessLogFields(t *testing.T) {
{"invalid=%REQ%"},
{"invalid=%TRAILER%"},
{"invalid=%RESP%"},
+ {"invalid=%REQ_WITHOUT_QUERY%"},
{"@timestamp", "invalid=%START_TIME(%s.%6f):10%"},
}
@@ -227,12 +228,13 @@ func TestValidateAccessLogFields(t *testing.T) {
{"@timestamp", "response_duration"},
{"@timestamp", "duration=%DURATION%.0"},
{"@timestamp", "duration=My duration=%DURATION%.0"},
- {"@timestamp", "duratin=%START_TIME(%s.%6f)%"},
+ {"@timestamp", "duration=%START_TIME(%s.%6f)%"},
{"@timestamp", "content-id=%REQ(X-CONTENT-ID)%"},
{"@timestamp", "content-id=%REQ(X-CONTENT-ID):10%"},
{"@timestamp", "length=%RESP(CONTENT-LENGTH):10%"},
{"@timestamp", "trailer=%TRAILER(CONTENT-LENGTH):10%"},
{"@timestamp", "duration=my durations are %DURATION%.0 and method is %REQ(:METHOD)%"},
+ {"path=%REQ_WITHOUT_QUERY(X-ENVOY-ORIGINAL-PATH?:PATH)%"},
{"dog=pug", "cat=black"},
}
@@ -530,3 +532,58 @@ network:
num-trusted-hops: 1
`)
}
+
+func TestAccessLogFormatString(t *testing.T) {
+ errorCases := []string{
+ "%REQ=dog%\n",
+ "%dog(%\n",
+ "%REQ()%\n",
+ "%DOG%\n",
+ "my durations % are %DURATION%.0 and %REQ(:METHOD)%\n",
+ "%REQ%\n",
+ "%TRAILER%\n",
+ "%RESP%\n",
+ "%REQ_WITHOUT_QUERY%\n",
+ "%START_TIME(%s.%6f):10%\n",
+ "no newline at the end",
+ }
+
+ for _, c := range errorCases {
+ assert.Error(t, validateAccessLogFormatString(c), c)
+ }
+
+ successCases := []string{
+ "%DURATION%.0\n",
+ "My duration %DURATION%.0\n",
+ "%START_TIME(%s.%6f)%\n",
+ "%REQ(X-CONTENT-ID)%\n",
+ "%REQ(X-CONTENT-ID):10%\n",
+ "%RESP(CONTENT-LENGTH):10%\n",
+ "%TRAILER(CONTENT-LENGTH):10%\n",
+ "my durations are %DURATION%.0 and method is %REQ(:METHOD)%\n",
+ "queries %REQ_WITHOUT_QUERY(X-ENVOY-ORIGINAL-PATH?:PATH)% removed\n",
+ "just a string\n",
+ }
+
+ for _, c := range successCases {
+ assert.NoError(t, validateAccessLogFormatString(c), c)
+ }
+}
+
+// TestAccessLogFormatExtensions tests that command operators requiring extensions are recognized for given access log format.
+func TestAccessLogFormatExtensions(t *testing.T) {
+ p1 := Parameters{
+ AccessLogFormat: EnvoyAccessLog,
+ AccessLogFormatString: "[%START_TIME%] \"%REQ_WITHOUT_QUERY(X-ENVOY-ORIGINAL-PATH?:PATH)%\"\n",
+ }
+ assert.Equal(t, []string{"envoy.formatter.req_without_query"}, p1.AccessLogFormatterExtensions())
+
+ p2 := Parameters{
+ AccessLogFormat: JSONAccessLog,
+ AccessLogFields: []string{"@timestamp", "path=%REQ_WITHOUT_QUERY(X-ENVOY-ORIGINAL-PATH?:PATH)%"},
+ }
+ assert.Equal(t, []string{"envoy.formatter.req_without_query"}, p2.AccessLogFormatterExtensions())
+
+ p3 := Defaults()
+ assert.Empty(t, p3.AccessLogFormatterExtensions())
+}
diff --git a/site/content/docs/main/configuration.md b/site/content/docs/main/configuration.md
index 1721215e5fe..0f133cbb348 100644
--- a/site/content/docs/main/configuration.md
+++ b/site/content/docs/main/configuration.md
@@ -13,7 +13,7 @@ Contour has a precedence of configuration for contour serve, meaning anything co
## Serve Flags
The `contour serve` command is the main command which is used to watch for Kubernetes resource and process them into Envoy configuration which is then streamed to any Envoy via its xDS gRPC connection.
-There are a number of flags that can be passed to this command which further configures how Contour operates.
+There are a number of flags that can be passed to this command which further configures how Contour operates.
Many of these flags are mirrored in the [Contour Configuration File](#configuration-file).
| Flag Name | Description |
@@ -64,6 +64,7 @@ Where Contour settings can also be specified with command-line flags, the comman
| Field Name | Type | Default | Description |
|------------|------|---------|-------------|
| accesslog-format | string | `envoy` | This key sets the global [access log format][2] for Envoy. Valid options are `envoy` or `json`. |
+| accesslog-format-string | string | None | If present, this specifies custom access log format for Envoy. See [Envoy documentation](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage) for more information about the syntax. This field only has effect if `accesslog-format` is `envoy` |
| debug | boolean | `false` | Enables debug logging. |
| default-http-versions | string array | HTTP/1.1
HTTP/2
| This array specifies the HTTP versions that Contour should program Envoy to serve. HTTP versions are specified as strings of the form "HTTP/x", where "x" represents the version number. |
| disableAllowChunkedLength | boolean | `false` | If this field is true, Contour will disable the RFC-compliant Envoy behavior to strip the `Content-Length` header if `Transfer-Encoding: chunked` is also set. This is an emergency off-switch to revert back to Envoy's default behavior in case of failures. |
@@ -72,7 +73,7 @@ Where Contour settings can also be specified with command-line flags, the comman
| envoy-service-namespace | string | `projectcontour` | This sets the namespace of the service that will be inspected for address details to be applied to Ingress objects. If the `CONTOUR_NAMESPACE` environment variable is present, Contour will populate this field with its value. |
| ingress-status-address | string | None | If present, this specifies the address that will be copied into the Ingress status for each Ingress that Contour manages. It is exclusive with `envoy-service-name` and `envoy-service-namespace`.|
| incluster | boolean | `false` | This field specifies that Contour is running in a Kubernetes cluster and should use the in-cluster client access configuration. |
-| json-fields | string array | [fields][5]| This is the list the field names to include in the JSON [access log format][2]. |
+| json-fields | string array | [fields][5]| This is the list the field names to include in the JSON [access log format][2]. This field only has effect if `accesslog-format` is `json`. |
| kubeconfig | string | `$HOME/.kube/config` | Path to a Kubernetes [kubeconfig file][3] for when Contour is executed outside a cluster. |
| leaderelection | leaderelection | | The [leader election configuration](#leader-election-configuration). |
| policy | PolicyConfig | | The default [policy configuration](#policy-configuration). |
@@ -283,6 +284,8 @@ data:
### Logging options
# Default setting
accesslog-format: envoy
+ # The default access log format is defined by Envoy but it can be customized by setting following variable.
+ # accesslog-format-string: "...\n"
# To enable JSON logging in Envoy
# accesslog-format: json
# The default fields that will be logged are specified below.
@@ -328,7 +331,7 @@ data:
# cluster:
# configure the cluster dns lookup family
# valid options are: auto (default), v4, v6
- # dns-lookup-family: auto
+ # dns-lookup-family: auto
#
# network:
# Configure the number of additional ingress proxy hops from the
@@ -393,7 +396,7 @@ The bootstrap configuration file is generated by an initContainer in the Envoy d
This configuration file configures the Envoy container to connect to Contour and receive configuration via xDS.
The next section outlines all the available flags that can be passed to the `contour bootstrap` command which are used to customize
-the configuration file to match the environment in which Envoy is deployed.
+the configuration file to match the environment in which Envoy is deployed.
### Flags