Skip to content

proxy: Add a /logs.json admin endpoint #7250

@olix0r

Description

@olix0r

It can be cumbersome (and expensive!) to get detailed proxy logs while the proxy is running. It would be better if we could stream logs with a custom log level from an admin endpoint, especially when gathering information for a bug report. Doing so should not alter the log level of logging emitted to stdout.

It's probably best to emit JSON-structured logs so that it's possible to inspect them programatically.

Questions:

  • Should we use POST /logs.json to indicate that we're creating a subscription? Or is this exposing an implementation detail? Is this effectively a GET?
  • How should the tracing spec be encoded? If we're POSTing a log spec, we could use a JSON object to more explicitly express the logging spec. Or we could use the EnvFilter format that the proxy already accepts. The latter is probably
  • We need to take care to ensure that writing response data does not cause more data to be logged! If, for instance, we tried to stream logs with hyper=trace, we could get into a situation where writing the logs response causes us to log more, which requires writing more logs in the response, etc... Ideally we would make it impossible for the logging endpoint to generate logs in this case.
  • We'll need to think about how to authorize requests to this endpoint.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions