Skip HTTP logs with unparseable timestamps instead of crashing#1
Closed
Sayan- wants to merge 1 commit into
Closed
Conversation
A single HTTP log with a missing or non-RFC3339 timestamp caused getHttpLogs to return a fatal error, which propagates to os.Exit and takes down the whole forwarder. Since the upstream log attribute shape can change, this turns one malformed log into a crash loop. Log and skip the offending log instead, matching how the path and status code attributes in the same loop are already handled. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4e8cf99 to
c9126cf
Compare
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.
Summary
getHttpLogsreturns a fatal error when a single HTTP log has a missing or non-RFC3339 timestamp. That error propagates up throughSubscribeToHttpLogstomain, which callsos.Exit(1)— so one malformed log takes down the entire forwarder. Because the upstream HTTP-log attribute shape can change over time (the README itself warns root attributes "are subject to change"), this is a latent crash-loop: every restart re-reads the same bad log and exits again.This changes that one path to log-and-skip the offending log and continue, matching how the
pathandhttpStatusattributes in the same loop are already handled.Why
A production forwarder deployment exited and was restarted by the platform; the process-exit-on-any-subscription-error design means transient or malformed input can drop the whole log pipeline. A single bad timestamp should not be fatal.
Test plan
go build ./...passestimestampattribute is logged and skipped, and forwarding continues for subsequent logs