Commit 1b96d5d
mcp: configure access logs for upstream mcp servers (envoyproxy#1302)
**Description**
Previously, we only had access logs for the main gateway listeners, but
not for the internal listener created to route requests to the upstream
MCP servers.
This PR configures the access logs for the upstream MCP server listener
with the same settings as the gateway access logs, to have logs for the
MCP server upstream accesses. With this change, MCP upstream access logs
will appear as well, and, if configured, the MCP metadata will also be
present:
<details>
<summary>
<strong>Example initialize:</strong> We can see now the main POST
request as well as the 2 initialize requests to the upstream MCP servers
and the corresponding notifications.
</summary>
```json
{
"bytes_received": 259,
"bytes_sent": 329,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58117",
"duration": 870,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "context7",
"mcp_method": "initialize",
"mcp_request_id": "9f518a27-08ab-4d01-92fd-5fd2b560957c",
"mcp_session_id": null,
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:40:13.834Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-context7/rule/0",
"upstream_host": "13.217.64.66:443",
"upstream_local_address": "192.168.40.127:58119",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp",
"x-request-id": "98ad661e-080a-4ae2-bb62-efebdb2a248e"
}
{
"bytes_received": 66,
"bytes_sent": 0,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58117",
"duration": 118,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "context7",
"mcp_method": "notifications/initialized",
"mcp_request_id": "<nil>",
"mcp_session_id": null,
"method": "POST",
"response_code": 202,
"start_time": "2025-10-08T10:40:14.706Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-context7/rule/0",
"upstream_host": "13.217.64.66:443",
"upstream_local_address": "192.168.40.127:58119",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp",
"x-request-id": "6b49ac24-6ec2-4291-a39f-0c6a31f06e61"
}
{
"bytes_received": 259,
"bytes_sent": 362,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58116",
"duration": 1068,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "github",
"mcp_method": "initialize",
"mcp_request_id": "8c86794e-0f5e-472a-852b-92632d6aafc8",
"mcp_session_id": null,
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:40:13.832Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-github/rule/0",
"upstream_host": "140.82.114.21:443",
"upstream_local_address": "192.168.40.127:58118",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp/readonly",
"x-request-id": "b84bfe17-b783-47d7-b565-8ac0036101b6"
}
{
"bytes_received": 66,
"bytes_sent": 0,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58116",
"duration": 211,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "github",
"mcp_method": "notifications/initialized",
"mcp_request_id": "<nil>",
"mcp_session_id": "09f09ce2-e99a-4ef2-91e1-b1d4a161dd00",
"method": "POST",
"response_code": 202,
"start_time": "2025-10-08T10:40:14.901Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-github/rule/0",
"upstream_host": "140.82.114.21:443",
"upstream_local_address": "192.168.40.127:58118",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp/readonly",
"x-request-id": "2891fff9-2130-4a61-8f1e-5ee774e19856"
}
{
"bytes_received": 222,
"bytes_sent": 317,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:1975",
"downstream_remote_address": "127.0.0.1:58114",
"duration": 1325,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": null,
"mcp_method": null,
"mcp_request_id": null,
"mcp_session_id": null,
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:40:13.829Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-main-mcp-route/rule/0",
"upstream_host": "127.0.0.1:9856",
"upstream_local_address": "127.0.0.1:58115",
"upstream_transport_failure_reason": null,
"user-agent": "node-fetch",
"x-envoy-origin-path": "/mcp",
"x-request-id": "b12dac6e-b1f0-4af2-b500-3a89cc053c3d"
}
```
</details>
<details>
<summary>
<strong>Example tool list:</strong> We can see now the main POST request
as well as the 2 tool list requests to the upstream MCP servers.
</summary>
```json
{
"bytes_received": 85,
"bytes_sent": 2709,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58116",
"duration": 701,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "context7",
"mcp_method": "tools/list",
"mcp_request_id": "2",
"mcp_session_id": "",
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:41:19.100Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-context7/rule/0",
"upstream_host": "13.217.64.66:443",
"upstream_local_address": "192.168.40.127:58149",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp",
"x-request-id": "4e857bd1-7c11-483d-91d3-d06cd905fea6"
}
{
"bytes_received": 85,
"bytes_sent": 46095,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58124",
"duration": 1112,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "github",
"mcp_method": "tools/list",
"mcp_request_id": "2",
"mcp_session_id": "09f09ce2-e99a-4ef2-91e1-b1d4a161dd00",
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:41:19.100Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-github/rule/0",
"upstream_host": "140.82.113.21:443",
"upstream_local_address": "192.168.40.127:58148",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp/readonly",
"x-request-id": "2ed28447-cdee-4570-a1b4-91a2470b4408"
}
{
"bytes_received": 85,
"bytes_sent": 4550,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:1975",
"downstream_remote_address": "127.0.0.1:58122",
"duration": 1193,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": null,
"mcp_method": null,
"mcp_request_id": null,
"mcp_session_id": "LEUnsU/tza7AVbVNwuyF7Kt6e6I+r0IpgzJughZNn+RAHOwtcIN16vyUZgERIFA+iktVrP8mshIsd1MBBxgtM7ibTiOWJNZsRK/hFtB+yP8INego+Txfy9RoLzFsHm/vV6aACb6P+AHVZgz86EKne73VzcPLDTIcy2N2f7SgUkU=",
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:41:19.065Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-main-mcp-route/rule/0",
"upstream_host": "127.0.0.1:9856",
"upstream_local_address": "127.0.0.1:58123",
"upstream_transport_failure_reason": null,
"user-agent": "node-fetch",
"x-envoy-origin-path": "/mcp",
"x-request-id": "e62b8491-b32d-434f-9ff9-caf0f4bab4d1"
}
```
</details>
<details>
<summary>
<strong>Example tool call:</strong> We can see now the main POST request
as well as the tool call to the upstream MCP server.
</summary>
```json
{
"bytes_received": 165,
"bytes_sent": 10255,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:10088",
"downstream_remote_address": "127.0.0.1:58124",
"duration": 653,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": "context7",
"mcp_method": "tools/call",
"mcp_request_id": "3",
"mcp_session_id": null,
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:42:11.430Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-br-mcp-route-context7/rule/0",
"upstream_host": "13.217.64.66:443",
"upstream_local_address": "192.168.40.127:58172",
"upstream_transport_failure_reason": null,
"user-agent": "Go-http-client/1.1",
"x-envoy-origin-path": "/mcp",
"x-request-id": "cf2c0454-6290-498e-af6c-e32a611b5da1"
}
{
"bytes_received": 175,
"bytes_sent": 10350,
"connection_termination_details": null,
"downstream_local_address": "127.0.0.1:1975",
"downstream_remote_address": "127.0.0.1:58122",
"duration": 725,
"genai_backend_name": null,
"genai_model_name": null,
"genai_model_name_override": null,
"genai_tokens_input": null,
"genai_tokens_output": null,
"mcp_backend": null,
"mcp_method": null,
"mcp_request_id": null,
"mcp_session_id": "LEUnsU/tza7AVbVNwuyF7Kt6e6I+r0IpgzJughZNn+RAHOwtcIN16vyUZgERIFA+iktVrP8mshIsd1MBBxgtM7ibTiOWJNZsRK/hFtB+yP8INego+Txfy9RoLzFsHm/vV6aACb6P+AHVZgz86EKne73VzcPLDTIcy2N2f7SgUkU=",
"method": "POST",
"response_code": 200,
"start_time": "2025-10-08T10:42:11.399Z",
"upstream_cluster": "httproute/default/ai-eg-mcp-main-mcp-route/rule/0",
"upstream_host": "127.0.0.1:9856",
"upstream_local_address": "127.0.0.1:58123",
"upstream_transport_failure_reason": null,
"user-agent": "node-fetch",
"x-envoy-origin-path": "/mcp",
"x-request-id": "fc253d7b-2c80-4fa6-972e-3d8aae25be29"
}
```
</details>
**Related Issues/PRs (if applicable)**
N/A
**Special notes for reviewers (if applicable)**
N/A
---------
Signed-off-by: Ignasi Barrera <[email protected]>
Signed-off-by: Hrushikesh Patil <[email protected]>1 parent 8533378 commit 1b96d5d
File tree
23 files changed
+531
-101
lines changed- examples
- aigw
- mcp
- internal
- autoconfig
- testdata
- extensionserver
- site/docs/capabilities/observability
23 files changed
+531
-101
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
55 | 75 | | |
56 | 76 | | |
57 | 77 | | |
| |||
237 | 257 | | |
238 | 258 | | |
239 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
240 | 300 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 301 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
265 | 272 | | |
266 | 273 | | |
267 | 274 | | |
| 275 | + | |
268 | 276 | | |
269 | 277 | | |
270 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
321 | 324 | | |
322 | 325 | | |
323 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
324 | 362 | | |
325 | 363 | | |
326 | 364 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
0 commit comments