应用服务网格 ASM-访问日志各字段解读:1.18及以后版本

时间:2024-06-21 16:58:17

1.18及以后版本

1.18的访问日志提供JSON格式的内容,以如下JSON格式为例。

{
	"start_time": "%START_TIME%",
	"route_name": "%ROUTE_NAME%",
	"method": "%REQ(:METHOD)%",
	"path": "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%",
	"protocol": "%PROTOCOL%",
	"response_code": "%RESPONSE_CODE%",
	"response_flags": "%RESPONSE_FLAGS%",
	"response_code_details": "%RESPONSE_CODE_DETAILS%",
	"connection_termination_details": "%CONNECTION_TERMINATION_DETAILS%",
	"bytes_received": "%BYTES_RECEIVED%",
	"bytes_sent": "%BYTES_SENT%",
	"duration": "%DURATION%",
	"upstream_service_time": "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%",
	"x_forwarded_for": "%REQ(X-FORWARDED-FOR)%",
	"user_agent": "%REQ(USER-AGENT)%",
	"request_id": "%REQ(X-REQUEST-ID)%",
	"authority": "%REQ(:AUTHORITY)%",
	"upstream_host": "%UPSTREAM_HOST%",
	"upstream_cluster": "%UPSTREAM_CLUSTER%",
	"upstream_local_address": "%UPSTREAM_LOCAL_ADDRESS%",
	"downstream_local_address": "%DOWNSTREAM_LOCAL_ADDRESS%",
	"downstream_remote_address": "%DOWNSTREAM_REMOTE_ADDRESS%",
	"requested_server_name": "%REQUESTED_SERVER_NAME%",
	"upstream_transport_failure_reason": "%UPSTREAM_TRANSPORT_FAILURE_REASON%",
	"pod_name": "%ENVIRONMENT(POD_NAME)%",
	"pod_namespace": "%ENVIRONMENT(POD_NAMESPACE)%",
	"mesh_id": "%ENVIRONMENT(ISTIO_META_ASM_MESH_ID)%",
	"cluster_id": "%ENVIRONMENT(ISTIO_META_ASM_CLUSTER_ID)%",
}

其中日志标记与表1含义相同,新增字段解释见表2

表2 1.18及以上版本istio日志新增字段解读

Log operator

解释

样例

pod_name

产生日志的pod名称

istio-ingressgateway-1-15-7-r2-599d4cf747-ngcfd

pod_namespace

产生日志的pod的namespace

istio-system

mesh_id

网格ID

84961386-6d84-929d-98bd-c5aee93b5c88

cluster_id

集群ID

84961386-6d84-929d-98bd-c5aee93b5c88

support.huaweicloud.com/usermanual-asm/asm_01_0142.html