-
-
Notifications
You must be signed in to change notification settings - Fork 87
feat: JSON output format for log messages #653
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7acd329 to
ad6fd9c
Compare
abc3
reviewed
May 15, 2025
Contributor
abc3
left a comment
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.
🔥 🔥 🔥
Contributor
|
would be interesting to stress test EC2 with heavy writes and see how IOPS react 🤔 |
84167fc to
087f7ec
Compare
97bde4d to
27f174e
Compare
chasers
approved these changes
Jun 2, 2025
Output logs in line JSON format (JSON object per line) in format that is as similar to the format that is expected by the Logflare as possible. The idea there is to log to the Vector which will then take care of logging to file(s) and to dispatch the logs to Logflare.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Output logs in line JSON format (JSON object per line) in format that is as similar to the format that is expected by the Logflare as possible.
The idea there is to log to the Vector which will then take care of logging to file(s) and to dispatch the logs to Logflare.
It provides 3 new ENV variables that we need to set in deployment:
SUPAVISOR_LOG_FILE_PATH=<path>- path to file where we want to store our logs. These logs are automatically rotated and up to 5 files (each max 8 MiB, though I think we can make it configurable or larger) are storedSUPAVISOR_LOG_FORMAT=jsonto output logs in Logflare JSON formatSUPAVISOR_ACCESS_LOG_FILE_PATH=<path>- path to access log forfail2banprocessingThat is current approach. I also started using
SUPAVISOR_prefix to all (new) environment variables that are used to configure Supavisor, to easily scan for variables that we are defining. Current uses of Logflare will work as is, that behaviour is not removed, but the Supavisor will log to stdout (or file if specified) by default now. I wonder whether we should always log to stdout and log to file in addition to logging to stdout. That is open and that is almost one line change if needed.This module https://github.com/supabase/supavisor/pull/653/files#diff-fcb4c5de26c4fdbe08d536956db8eb369be522fa167e1c43638c936caa9684b4 would probably need to be exported to some new Logflare library (cc @Ziinc), but for simplicity it is currently in Supavisor. I haven't yet written proper test for it.
I also have added new metadata field for logs in
ClientHandler-state. It contains the connection state at the time of log. It is mostly useful for logging access logs (as these are heavily limited) where I log only events inexchangestate (as it is where all connection failures happen). I also set logger metadata much earlier in the connection setup to be able to see all that info ASAP.This code also utilises new
JSONmodule in Elixir, so it requires fairly recent (1.18) Elixir and OTP 27+.