Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (optional) debug logging for console requests #3440

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

ramondeklein
Copy link
Collaborator

There are cases where issues arise with the console for HTTP request and/or websockets that are hard to debug, because we can't trace the requests. This PR adds functionality to add debug logging middleware that logs HTTP requests (including websockets). This can be enabled by setting the CONSOLE_DEBUG_LOGLEVEL environment variable to one of the following values:

  • 0 (default) uses no logging.
  • 1 log single line per request for server-side errors (status-code 5xx).
  • 2 log single line per request for client-side and server-side errors (status-code 4xx/5xx).
  • 3 log single line per request for all requests (status-code 4xx/5xx).
  • 4 log details per request for server-side errors (status-code 5xx).
  • 5 log details per request for client-side and server-side errors (status-code 4xx/5xx).
  • 6 log details per request for all requests (status-code 4xx/5xx).

A single line logging has the following information:

  • Remote endpoint (IP + port) of the request. Note that reverse proxies may hide the actual remote endpoint of the client's browser.
  • HTTP method and URL
  • Status code of the response (websocket connections are hijacked, so no response is shown)
  • Duration of the request

The detailed logging also includes all request and response headers (if any).

@ramondeklein ramondeklein merged commit 6cfc985 into minio:master Sep 20, 2024
30 of 33 checks passed
@ramondeklein ramondeklein deleted the add-debug-logging branch September 20, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants