Skip to content

Use different AccessLog expressions for LLM and MCP routers #1303

@codefromthecrypt

Description

@codefromthecrypt

As far as I can tell, Envoy Gateway doesn't have a per-route access logging configuration. I would like to use one for /mcp and another for everything else (implicitly LLM). If this already exists, please close this issue with an example yaml.

Currently, we write a log expression which has many potentially nil fields as well as LLM specific ones.

Here's an example of an LLM request with a down upstream, noting this is a pared down expression from what we usually use.

{"bytes_received":122,"bytes_sent":19,"connection_termination_details":null,"downstream_local_address":"127.0.0.1:1975","downstream_remote_address":"127.0.0.1:60052","duration":1,"genai_backend_name":null,"genai_model_name":"qwen2.5:0.5b","genai_model_name_override":null,"genai_tokens_input":null,"genai_tokens_output":null,"method":"POST","response_code":503,"start_time":"2025-10-08T10:50:31.634Z","upstream_cluster":"httproute/default/aigw-run/rule/0","upstream_host":null,"upstream_local_address":null,"upstream_transport_failure_reason":null,"user-agent":"curl/8.7.1","x-envoy-origin-path":"/v1/chat/completions","x-request-id":"5dfa983f-f787-4f4d-91de-026aaff7efe6"}

Consider an MCP request to the same.. genai_XXX fields will be invalid. Now, consider that MCP has different fields it would need, but in order to add them, we need to update the global expression. This would make both worse because we cannot omit fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions