我希望能够捕获(日志)(至少部分)envoy
我的 HTTP 标头istio
服务网格。
我已经经历过envoy
's docs https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/run-envoy#debugging-envoy,并且在日志级别部分中,它没有提及任何特定于标头的信息。
目前,我的istio-proxy
日志是这样的(这是来自stern
输出):
mysvc-69c46fbc75-d9v8j istio-proxy {"bytes_sent":"124","upstream_cluster":"inbound|80|http|mysvc.default.svc.cluster.local","downstream_remote_address":"10.11.11.1:0","authority":"some.url.com","path":"/health?source=dd_cluster_agent","protocol":"HTTP/1.1","upstream_service_time":"1","upstream_local_address":"127.0.0.1:40406","duration":"2","upstream_transport_failure_reason":"-","route_name":"default","downstream_local_address":"10.11.32.32:20000","user_agent":"Datadog Agent/7.24.0","response_code":"200","response_flags":"-","start_time":"2021-01-17T18:54:57.449Z","method":"GET","request_id":"61ae63c7-aa10-911b-9562-939kdhd49ddhj","upstream_host":"127.0.0.1:20000","x_forwarded_for":"10.16.32.1","requested_server_name":"outbound_.80_.mysvc_.faros.default.svc.cluster.local","bytes_received":"0","istio_policy_status":"-"}
有没有办法登录http
标题? (理想情况下some其中,以控制伐木成本)
edit1按照评论中的建议,我检查了我的istio-operator
资源,我看到访问日志记录似乎已启用
meshConfig:
accessLogEncoding: JSON
accessLogFile: /dev/stdout
edit2我还尝试过以下方法:
curl -i -H "Custom-Header: application/json" https://my.url.net
但在日志中istio-ingressgateway
我没有看到我的自定义标头
istio-ingressgateway-58f69d8696-rmpwn istio-proxy {"user_agent":"curl/7.64.1","response_code":"200","response_flags":"-","start_time":"2021-01-18T19:02:48.645Z","method":"GET","request_id":"8e32c93c-484d-9c56-9489-8c5392793d97","upstream_host":"10.16.32.55:20000","x_forwarded_for":"10.16.32.1","requested_server_name":"my.url.net","bytes_received":"0","istio_policy_status":"-","bytes_sent":"124","upstream_cluster":"outbound|80||mysvc.default.svc.cluster.local","downstream_remote_address":"10.16.32.1:52804","authority":"my.url.net","path":"/","protocol":"HTTP/2","upstream_service_time":"9","upstream_local_address":"10.16.32.17:49826","duration":"10","upstream_transport_failure_reason":"-","route_name":"-","downstream_local_address":"10.16.32.17:8443"}