-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Implement logs websocket #23016
Implement logs websocket #23016
Conversation
🦋 Changeset detectedLatest commit: 6863bc7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of initial thoughts looking at this PR :)
Since this WS endpoint will only have a single purpose we could simplify the handler a bit:
- require authentication mode
strict
and admin only - instead of recreating a subscription model the connection itself can be a subscription where a successful connection is "subscribed" and a closed connection "unsubscribed"
And as extra thought, do we want to buffer some logs so there is some backlog to be fetched/rendered? Or do we want to keep it fully ephemeral
* simplify logging handler * enforce strict mode * Update logs handler * Update docs --------- Co-authored-by: ian <licitdev@gmail.com>
* Implement logs websocket * Update docs * Remove commented test code * fixed controller shared logic * fixed controller type * Added shutdown callback * Expose allowed log levels * Use a different event * Add log level filtering * Return log_level when subscribed * Remove unused import * Limit logs websocket to `strict` auth mode (directus#23023) * simplify logging handler * enforce strict mode * Update logs handler * Update docs --------- Co-authored-by: ian <licitdev@gmail.com> * Add unique nodeId as uid * Create logStream only when required * Add admin requirement check * Extract isValidLogLevel as util * Remove authentication and path from server info * Remove hostname and pid from logs if not raw * Fix nodeId implementation * Support custom log levels * Fix build * Fix test * Remove unused constants and util * Display websocket logs details in server info for admins only * Expose log level value in server info * Stream raw logs to websocket * Retain hostname and pid field in raw logs * Add separate env var for logs streaming * Reset attempts after reconnection failure * Remove obsolete accountability refreshing * Run handler only when enabled * Add changeset * Allow wss protocol * Rename to logs-stream * Add unit tests * Add explicit check for the remaining client * Updated json stringification in log-streaming * prettier --------- Co-authored-by: Brainslug <tim@brainslug.nl> Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Scope
What's changed:
Potential Risks / Drawbacks
Review Notes / Questions
TODO
Fixes #22482