fix: Fix log processing rule on orphan log#912
Merged
Conversation
litianningdatadog
approved these changes
Oct 30, 2025
astuyve
reviewed
Oct 31, 2025
| for mut orphan_log in self.orphan_logs.drain(..) { | ||
| orphan_log.message.lambda.request_id = | ||
| Some(self.invocation_context.request_id.clone()); | ||
| let should_send_log = self.logs_enabled |
Contributor
There was a problem hiding this comment.
Oh god, this failed because we shadowed the should_send_log variable?
This reassignment works, but can we refactor this into an instance method which just borrows the message itself?
If that is too complicated to pass the borrow checker, can we instead rename this variable to orphan_should_send_log so we don't reshadow this?
Contributor
Author
There was a problem hiding this comment.
It failed because we reused the result of should_send_log from the first message for all the log messages.
Will try to refactor this.
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.
Problem
When a user follows our doc to set the env var:
DD_LOGS_CONFIG_PROCESSING_RULES:[{"type": "exclude_at_match", "name": "exclude_start_and_end_logs", "pattern": "(START|END|REPORT) RequestId"}], we not only excludesSTART,ENDandREPORTlogs, but some other logs as well, such as (1) extension log and (2) error log from the Lambda handler. As a result, errors can be left unobserved.Bug
This is because we first apply the log processing rules to the log we receive from telemetry API, to decide whether to send it to Datadog, then use the same result for "orphan log", which may include extension log and user error log.
This PR
For each orphan log, evaluate log processing rules again, instead of reusing the existing result.
Testing
Setup
DD_LOGS_CONFIG_PROCESSING_RULES:[{"type": "exclude_at_match", "name": "exclude_start_and_end_logs", "pattern": "(START|END|REPORT) RequestId"}]Result before:
No log showed up in Datadog's Log Explorer or Live Tail
Result after:
Custom error log and extension log showed up.

Notes
Thanks @duncanista @astuyve @litianningdatadog for debugging and discussion.
Jira: https://datadoghq.atlassian.net/browse/SLES-2469