Repository navigation
Conversation
Apply the level/logger parsing to workspace pods as well as coderd and provisioners, since workspace agents log in the same format. Once parsed, the timestamp becomes the entry's time and the level and logger become labels, so keep only the message as the stored line instead of repeating all three in the text. The regex now treats the logger as optional, so lines from the root logger such as "Started HTTP listener at http://..." keep their whole message and carry no logger label, and it matches across newlines so multi-line entries such as stack traces are kept in full. Lines that do not match, such as other output in a workspace pod, are left untouched. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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
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.
Stacked on #106; the base is that branch and GitHub will retarget this to
mainonce it merges.Two changes to how Coder logs are processed in Alloy.
Parse every Coder component. The
level/loggerparsing now applies to workspace pods as well as coderd and provisioners, since workspace agents log in the same format. Thecomponentlabel from #106 decides which pods are parsed.Keep only the message in the stored line. Today the stored line still begins with the timestamp,
[level]and logger name, so Grafana shows the time and severity twice: once from Loki and once in the text. Once parsed, the timestamp is the entry's time and the level and logger are labels, so the line now holds only the message. Filter with labels ({component="coderd", level="error"}) instead of matching text like[error]. Lines already in Loki keep their old text and age out normally.While in there, the regex is tightened so stripping can't mangle a message:
Started HTTP listener at http://0.0.0.0:3000previously matched[^:]+and would have had everything up tohttp:taken as the logger; they now keep the whole message and get nologgerlabel (an empty one is dropped).Checked by running the rendered
loki.process "pod_logs"pipeline in Alloy v1.20.1 against sample CRI logs: a normal line, a root-logger line, a multi-line panic,[WARN]text in the message, a non-Coder line in a workspace pod, and a Coder-format line in a workspace pod. Each came out with the expected labels, timestamp and message. The rendered config also passesalloy fmt, and the chart lints and renders with each selector blanked.🤖 Generated with Claude Code