istio-proxy 访问日志是什么意思?

What is istio-proxy access log mean?

我正在尝试通过查看 istio-proxy 访问日志(它记录每次访问)来排除我的服务故障。但是,我找不到任何文档来解释日志中每个条目的含义。

例如

[2018-12-20T11:09:42.302Z] "GET / HTTP/1.1" 200 - 0 614 0 0 "10.32.96.32" "curl/7.54.0" "17b8f245-af00-4379-9f8f-a4dcd2f38c01" "foo.com" "127.0.0.1:8080"

上面的日志是什么意思?

已更新

我试过了, but I couldn't find the log format data. Here's the output json file。有什么我想念的吗? 我正在使用 istio-1.0.0

Istio 代理访问日志的配置被定义为 envoy.http_connection_managerenvoy.tcp_proxy 过滤器的一部分。要查看它的配置,运行:

istioctl proxy-config listeners <your pod> -n <your namespace> -o json

为 HTTP 搜索 access_log,共 envoy.http_connection_manager,为 TCP 搜索 access_log,共 envoy.tcp_proxy

你会看到这样的东西:

 "filters": [
                {
                    "name": "envoy.http_connection_manager",
                    "config": {
                        "access_log": [
                            {
                                "config": {
                                    "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME%\n",
                                    "path": "/dev/stdout"

检查日志属性定义 here

如果在上面的输出中未指定 access_log 的格式,则使用 the default format

Istio/Envoy 访问日志带有默认格式。 这里是默认格式

[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"\n

它与您提供的示例日志条目相匹配。您可以找到有关字段的更多详细信息以及有关 envoy 访问日志的一般信息 here

日志格式如下:

\[%{TIMESTAMP_ISO8601:timestamp}\] \"%{DATA:method} (?:%{URIPATH:uri_path}(?:%{URIPARAM:uri_param})?|%{DATA:}) %{DATA:protocol}\" %{NUMBER:status_code} %{DATA:response_flags} \"%{**DATA:mixer_status**}\" %{NUMBER:bytes_received} %{NUMBER:bytes_sent} %{NUMBER:duration} (?:%{NUMBER:upstream_service_time}|%{DATA:tcp_service_time}) \"%{DATA:forwarded_for}\" \"%{DATA:user_agent}\" \"%{DATA:request_id}\" \"%{DATA:authority}\" \"%{DATA:upstream_service}\" %{DATA:upstream_cluster} %{DATA:upstream_local} %{DATA:downstream_local} %{DATA:downstream_remote} %{**DATA:requested_server**}

这里是真实日志:

[2019-09-05T06:55:32.008Z] "GET /solutionprofile/api/v1/health HTTP/1.1" 200 - "-" 0 16 10 10 "-" "kube-probe/1.12" "dc9ac3b2-2ee4-4a4b-967e-8f0cc3953e80" "10.228.69.15:3000" "127.0.0.1:3000" inbound|80|http|hp-solutionprofile-service.hp.svc.cluster.local - 10.228.69.15:3000 10.228.69.1:59692 -