-
Notifications
You must be signed in to change notification settings - Fork 543
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
Split Container Logs sources for stdout vs stderr #11
Conversation
Image/gif? |
Added an image, though its nothing new - just the same red coloring for error logs, and a little clarification of what changed. I do have concerns about the stdout vs stderr intermingling, though, which I just added in chat. |
We should rethink the coloring of logs based on whether they are delivered via The classic Unix design is |
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.
Looks great to me, just a couple suggestions/questions--HTH!
} | ||
} | ||
|
||
[GeneratedRegex("^(?:\\d{4})-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9])(?:\\.\\d{1,9})(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])?$")] |
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.
Where this came from? How do I ensure that this is correct, or update this? I think a comment would be very helpful here.
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.
I added a comment with details on the parts of this. It's both straightforward (no real regex trickery) and complicated (because its still regex). That also led me to realize part of it was wrong, so good idea there. The source was a combination of things, because no single source seemed to have a complete answer.
Interesting. I wasn't aware of that. It seems like we have a blend of both though, as postgres is clearly treating stderr as human readable messages (even pointing you to documentation, etc). This is another scenario of how I'm not sure what to do about the stdout vs stderr "how to display issue. |
We discussed this a bit during dashboard triage and we're going to follow up as part of a larger conversation about the log display. Lots of questions (timestamps vs none, timestamps on each row vs on each "log entry", stdout vs std error interleaving and synchronization, stdout vs std error coloring/rendering, etc). |
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.
Looks great
} | ||
} | ||
|
||
// Regular Expression for an RFC3339 timestamp, including RFC3339Nano |
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.
Thank you 🤗
// $ - Ends the string | ||
// | ||
// Note: (?:) is a non-capturing group, since we don't care about the values, we are just interested in whether or not there is a match | ||
[GeneratedRegex("^(?:\\d{4})-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9])(?:\\.\\d{1,9})?(?:Z|(?:[Z+-](?:[01][0-9]|2[0-3]):(?:[0-5][0-9])))?$")] |
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.
Not saying this has to be done now, but for such long regular expressions, I like to define the fragments as C# constant strings, and then interpolate them into the final regex. If you chose the names well (for the fragments), it is self-documenting. IgnorePatternWhitespace
option can also help.
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.
Makes sense. Whenever I need to change this (probably whenever we figure out the project timestamps) I'll change it to work that way. Thanks for the suggestion!
The Container logs had stdout/stderr as separate streams, but we were reading them into one channel without differentiation. This PR splits them up so that error log entries can be rendered differently to the page based on their actual source.
As an example, prometheus logs are apparently all stderr at the moment (even though they say "level=info" in them), so they all show up red:
I also cleaned up the way line numbers were rendered in the logs (doesn't change the display, just how we do the display) and detection of timestamps in the logs (RFC3339Nano only at the moment) so that we don't just render whatever the first non-whitespace characters are as the timestamp.