envoyproxy / envoyproxy/envoy

`response.grpc_status` is set to 2 for plain HTTP requests with 2xx response status

Open
#31,483 11 comments 2 reactions 0 assignees View on GitHub
area/access_log bug no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Title*: `response.grpc_status` is set to 2 for plain HTTP requests (with 2xx HTTP status code)

*Description*:
>What issue is being seen? Describe what should be happening instead of
the bug, for example: Envoy should not crash, the expected value isn't
returned, etc.

`response.grpc_status` is set to 2 for plain HTTP requests (with 2xx HTTP status code). This causes unexpected results when filtering access logs with expression likes this: `expression: "response.code >= 400 || response.grpc_status > 0`.

I would expect `response.grpc_status` to be set to `-`1 or not set at all when request isn't gRPC request.

*Repro steps*:
> Include sample requests, environment, etc. All data and inputs
required to reproduce the bug.

Use Istio v1.19.3 (that uses Envoy with sha256: `c3e7c2a9c657247c857b269f6a86099515d9bf294a1aff70c5d1ef2a562cdde3` - [link](https://github.com/istio/proxy/blob/1.19.3/WORKSPACE#L40C17-L40C81)) and configure its access log to contain `response.grpc_status` (see Config section below). Then performance HTTP request (any simple GET request is sufficient) that results in 200 OK response.

*Config*:
>Include the config used to configure Envoy.

`accessLogFormat: "[%START_TIME%] %CEL(response.grpc_status)% \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% %RESPONSE_CODE_DETAILS% \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %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% %ROUTE_NAME%\n"`

*Logs*:
>Include the access logs and the Envoy logs.

`[2023-12-21T09:07:13.121Z] 2 "GET /get HTTP/1.1" 200 - via_upstream "-" 0 600 1 1 "-" "curl/8.5.0" "371a0dc2-c607-967f-a7b2-010d0a46f551" "httpbin:8000" "10.244.0.23:8080" outbound|8000||httpbin.default.svc.cluster.local 10.244.0.24:47768 10.96.235.15:8000 10.244.0.24:47234 - default`

Above you can see that `response.grpc_status` is unexpectedly `2`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.