mirror of
https://github.com/alibaba/higress.git
synced 2026-05-24 12:47:27 +08:00
feat: Supports recording request header, request body, response header and response body information in the access log (#2265)
This commit is contained in:
137
plugins/wasm-go/extensions/log-request-response/envoy.yaml
Normal file
137
plugins/wasm-go/extensions/log-request-response/envoy.yaml
Normal file
@@ -0,0 +1,137 @@
|
||||
admin:
|
||||
address:
|
||||
socket_address:
|
||||
protocol: TCP
|
||||
address: 0.0.0.0
|
||||
port_value: 9901
|
||||
static_resources:
|
||||
listeners:
|
||||
- name: listener_0
|
||||
address:
|
||||
socket_address:
|
||||
protocol: TCP
|
||||
address: 0.0.0.0
|
||||
port_value: 10000
|
||||
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
|
||||
access_log:
|
||||
- name: envoy.access_loggers.file
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
|
||||
path: "/dev/stdout"
|
||||
format: |
|
||||
{
|
||||
"request_headers": "%FILTER_STATE(wasm.log-request-headers:PLAIN)%",
|
||||
"request_body": "%FILTER_STATE(wasm.log-request-body:PLAIN)%",
|
||||
"response_headers": "%FILTER_STATE(wasm.log-response-headers:PLAIN)%",
|
||||
"response_body": "%FILTER_STATE(wasm.log-response-body:PLAIN)%",
|
||||
"ai_log": "%FILTER_STATE(wasm.ai_log:PLAIN)%",
|
||||
"authority": "%REQ(X-ENVOY-ORIGINAL-HOST?:AUTHORITY)%",
|
||||
"bytes_received": "%BYTES_RECEIVED%",
|
||||
"bytes_sent": "%BYTES_SENT%",
|
||||
"downstream_local_address": "%DOWNSTREAM_LOCAL_ADDRESS%",
|
||||
"downstream_remote_address": "%DOWNSTREAM_REMOTE_ADDRESS%",
|
||||
"duration": "%DURATION%",
|
||||
"istio_policy_status": "%DYNAMIC_METADATA(istio.mixer:status)%",
|
||||
"method": "%REQ(:METHOD)%",
|
||||
"path": "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%",
|
||||
"protocol": "%PROTOCOL%",
|
||||
"request_id": "%REQ(X-REQUEST-ID)%",
|
||||
"requested_server_name": "%REQUESTED_SERVER_NAME%",
|
||||
"response_code": "%RESPONSE_CODE%",
|
||||
"response_flags": "%RESPONSE_FLAGS%",
|
||||
"route_name": "%ROUTE_NAME%",
|
||||
"start_time": "%START_TIME%",
|
||||
"trace_id": "%REQ(X-B3-TRACEID)%",
|
||||
"upstream_cluster": "%UPSTREAM_CLUSTER%",
|
||||
"upstream_host": "%UPSTREAM_HOST%",
|
||||
"upstream_local_address": "%UPSTREAM_LOCAL_ADDRESS%",
|
||||
"upstream_service_time": "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%",
|
||||
"upstream_transport_failure_reason": "%UPSTREAM_TRANSPORT_FAILURE_REASON%",
|
||||
"user_agent": "%REQ(USER-AGENT)%",
|
||||
"x_forwarded_for": "%REQ(X-FORWARDED-FOR)%",
|
||||
"response_code_details": "%RESPONSE_CODE_DETAILS%"
|
||||
}
|
||||
scheme_header_transformation:
|
||||
scheme_to_overwrite: https
|
||||
stat_prefix: ingress_http
|
||||
route_config:
|
||||
name: local_route
|
||||
virtual_hosts:
|
||||
- name: local_service
|
||||
domains: ["*"]
|
||||
routes:
|
||||
- match:
|
||||
prefix: "/"
|
||||
route:
|
||||
cluster: httpbin
|
||||
http_filters:
|
||||
- name: wasmdemo
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
|
||||
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
|
||||
value:
|
||||
config:
|
||||
name: wasmdemo
|
||||
vm_config:
|
||||
runtime: envoy.wasm.runtime.v8
|
||||
code:
|
||||
local:
|
||||
filename: /etc/envoy/main.wasm
|
||||
configuration:
|
||||
"@type": "type.googleapis.com/google.protobuf.StringValue"
|
||||
value: |
|
||||
{
|
||||
"request": {
|
||||
"headers": {
|
||||
"enabled": true
|
||||
},
|
||||
"body": {
|
||||
"enabled": true,
|
||||
"maxSize": 25,
|
||||
"contentTypes": [
|
||||
"application/json",
|
||||
"application/xml",
|
||||
"application/x-www-form-urlencoded",
|
||||
"text/plain"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"headers": {
|
||||
"enabled": true
|
||||
},
|
||||
"body": {
|
||||
"enabled": true,
|
||||
"maxSize": 100,
|
||||
"contentTypes": [
|
||||
"application/json",
|
||||
"application/xml",
|
||||
"text/plain",
|
||||
"text/html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
- name: envoy.filters.http.router
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||
clusters:
|
||||
- name: httpbin
|
||||
connect_timeout: 30s
|
||||
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: httpbin
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: httpbin
|
||||
port_value: 80
|
||||
Reference in New Issue
Block a user