-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Description
Title: ROUTE_NAME is not captured in access log when direct_response is used
Description:
#12850 introduced a bug whereby the ROUTE_NAME is not set when the access log is written if the route uses direct_response.
Repro steps:
Start envoy with a config that includes %ROUTE_NAME% in the access log, make a request, observe log does not have route name set...
docker run --rm -it \
-v $(pwd)/envoy.yaml:/etc/envoy/envoy.yaml \
-p 8000:8000 envoyproxy/envoy-dev:4f98ea66c93693f9a77403e9bb7bc6c3b81d2658 \
envoy --file-flush-interval-msec 100 -c /etc/envoy/envoy.yamlConfig:
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 8000
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: auto
stat_prefix: ingress_http
access_log:
name: envoy.file_access_log
typed_config:
"@type": type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog
path: /dev/stdout
typed_json_format:
time: "%START_TIME(%s%3f)%"
routeName: "%ROUTE_NAME%"
reqPath: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- name: direct
match: { path: /direct }
direct_response:
status: 404
body:
inline_string: |
{"errors":[{"code":404,"message":"The requested resource cannot be found"}]}
- name: google
match: { prefix: "/" }
route:
host_rewrite_literal: www.google.com
cluster: service_google
http_filters:
- name: envoy.filters.http.router
clusters:
- name: service_google
connect_timeout: 0.25s
type: LOGICAL_DNS
# Comment out the following line to test on v6 networks
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: service_google
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: www.google.com
port_value: 443
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
sni: www.google.comLogs:
log output since 4f98ea6:
{"reqPath":"/direct","time":"1600371515516","routeName":null}
{"time":"1600371521644","routeName":"google","reqPath":"/"}
log output with 622e66d:
{"routeName":"direct","reqPath":"/direct","time":"1600371638753"}
{"time":"1600371644528","routeName":"google","reqPath":"/"}
Reactions are currently unavailable