Skip to content
下载《AI 应用 & AI Agent 开发新范式》电子书 了解构建 AI Agent 和 MCP Server 的一线实践Know more

Log Description

Custom log fields can be configured using the following command to edit the accessLogFormat field under the mesh field:

Terminal window
kubectl edit cm -n higress-system higress-config

To view logs, you can use the following command:

Terminal window
kubectl logs -n higress-system -l app=higress-gateway --since=5m

Higress uses JSON format for logs by default, as shown below:

{
"authority": "%REQ(:AUTHORITY)%",
"bytes_received": "%BYTES_RECEIVED%",
"bytes_sent": "%BYTES_SENT%",
"downstream_local_address": "%DOWNSTREAM_LOCAL_ADDRESS%",
"downstream_remote_address": "%DOWNSTREAM_REMOTE_ADDRESS%",
"duration": "%DURATION%",
"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)%"
}

For the meaning of the Value configuration, please refer to Envoy Log Documentation

Field NameTypeMeaning
authoritystringHost Header in the request message.
bytes_receivedlongSize of the request body (excluding Header).
bytes_sentlongSize of the response body (excluding Header).
downstream_local_addressstringGateway Pod address.
downstream_remote_addressstringClient address connected to the gateway.
durationlongOverall request duration.
methodstringHTTP method.
pathstringPath in the HTTP request.
protocolstringHTTP protocol version.
request_idstringThe gateway generates an ID for each request and places it in the x-request-id header, which can be used by the backend for logging and troubleshooting.
requested_server_namestringServer Name used during SSL connection.
response_codelongHTTP response status code.
response_flagsstringReason for response failure.
route_namestringRoute name.
start_timestringRequest start time.
trace_idstringTrace ID.
upstream_clusterstringUpstream cluster.
upstream_hoststringUpstream IP.
upstream_local_addressstringLocal address connecting to the upstream.
upstream_service_timelongTime of the last call to the upstream service.
upstream_transport_failure_reasonstringReason for upstream connection failure.
user_agentstringUserAgent in the HTTP Header.
x_forwarded_forstringx-forwarded-for in the HTTP Header, typically used to represent the real IP of the HTTP request client.