-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.triage/needs-user-inputIssues which are waiting on a response from the reporterIssues which are waiting on a response from the reporter
Milestone
Description
What version of Knative?
1.11.2
Expected Behavior
Configured the request logging template following https://knative.dev/docs/serving/observability/logging/request-logging/
logging.request-log-template: >-
{"requestMethod": "{{.Request.Method}}", "requestUrl": "{{js
.Request.RequestURI}}", "requestSize": {{.Request.ContentLength}}, "code":
{{.Response.Code}}, "responseSize": {{.Response.Size}}, "userAgent": "{{js
.Request.UserAgent}}", "remoteIp": "{{js .Request.RemoteAddr}}", "serverIp":
"{{.Revision.PodIP}}", "referer": "{{js .Request.Referer}}", "latency":
{{.Response.Latency}}, "protocol": "{{.Request.Proto}}", "traceID": "{{index
(index .Request.Header "X-B3-Traceid") 0}}","msg":"Finished handling
request."}
Expected to output trace ID in the request logs:
{"requestMethod": "POST", "requestUrl": "/", "requestSize": 559, "code": 200, "responseSize": 27, "userAgent": "go-resty/2.16.5 (https://github.com/go-resty/resty)", "remoteIp": "10.36.180.90:53598", "serverIp": "10.36.134.94", "referer": "", "latency": 6.950939235, "protocol": "HTTP/1.1", "traceID": "012bf535a144fa584d40fe791b04ce18","msg":"Finished handling request."}
Actual Behavior
During traffic spikes, some request logs fail to parse according to the template and show the following error. I confirmed that every request comes from the same client and includes the X-B3-Traceid header.
{"requestMethod": "POST", "requestUrl": "/", "requestSize": 560, "code": 200, "responseSize": 27, "userAgent": "go-resty/2.16.5 (https://github.com/go-resty/resty)", "remoteIp": "10.36.183.136:42866", "serverIp": "10.36.178.75", "referer": "", "latency": 0.070215634, "protocol": "HTTP/1.1", "traceID": "Invalid request log template: method: POST, response code: 200, latency: 0.098454743, url: /
Steps to Reproduce the Problem
This occurs with some probability every time there's a traffic spike, but the root cause is uncertain.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.triage/needs-user-inputIssues which are waiting on a response from the reporterIssues which are waiting on a response from the reporter