feat: classify logs based on HTTP statusCode#3764
Open
difagume wants to merge 1 commit intoDokploy:canaryfrom
Open
feat: classify logs based on HTTP statusCode#3764difagume wants to merge 1 commit intoDokploy:canaryfrom
difagume wants to merge 1 commit intoDokploy:canaryfrom
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
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.
What is this PR about?
This PR improves log classification by detecting and categorizing logs based on the
statusCodefield when present in the message.Currently, some HTTP logs are misclassified despite clearly indicating their outcome via
statusCode. This change ensures they are categorized more accurately.The matcher supports both numeric and string representations, for example:
"statusCode": 200"statusCode": "200"Classification rules:
5xx→error4xx→warning2xx→successinfoTypeScript Playground example
Checklist
Before submitting this PR, please make sure that:
canarybranch.Screenshots
Screenshot showing the current log classification state.

Greptile Summary
This PR adds HTTP status code-based log classification to the
getLogTypefunction in the Docker logs viewer. When a log message contains a"statusCode"field (in JSON format), it is now classified by the status code value (5xx → error, 4xx → warning, 2xx → success, others → info) before falling back to keyword-based heuristics."statusCode"that handles both numeric and string representations (e.g.,"statusCode": 200and"statusCode": "200")getLogType— unit tests would help ensure correctness of both old and new classification pathsConfidence Score: 4/5
Last reviewed commit: 939ff81
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!