Skip to content

[AWSINTS-3506] feat(go-forwarder): add S3 pipeline (with multiline regex)#1108

Merged
ndakkoune merged 8 commits into
nabil.dakkoune/go-forwarderfrom
nabil.dakkoune/AWSINTS-3506
Apr 20, 2026
Merged

[AWSINTS-3506] feat(go-forwarder): add S3 pipeline (with multiline regex)#1108
ndakkoune merged 8 commits into
nabil.dakkoune/go-forwarderfrom
nabil.dakkoune/AWSINTS-3506

Conversation

@ndakkoune
Copy link
Copy Markdown
Contributor

@ndakkoune ndakkoune commented Apr 17, 2026

What does this PR do?

Implements the S3 pipeline with multiline regex support.

Motivation

Testing Guideline

Additional Notes

  • The Python Forwarder multiline regex behavior was only splitting on the provided regex AFTER it encountered a \r\n\f separator. This non-expected behavior has been fixed.
  • Will declare high level constants for shared key between S3 and CW to enhance maintainability (as the sourceCategory constant) in a future PR the CloudTrail implementation (will probably move a lot of things)

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)
  • This PR passes the unit tests
  • This PR passes the installation tests (ask a Datadog member to run the tests)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a better name for this file and struct type. I hesitated with lambda.go (could be confusing since we're speaking of the forwarder specifically) and context.go (confusing with the context package).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe metadata ?

Comment thread aws/logs_monitoring_go/internal/model/s3.go
}
}()

var buf strings.Builder
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To append \n and message without big reallocations.

}()

var buf strings.Builder
scanner := bufio.NewScanner(body)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default buffer is 64KB. We may want to benchmark it we want to optimize, or put 1-5MB to handle big lines.
Will use a json.Decoder for the big CloudTrail events as single JSON line inside a bucket.

@ndakkoune ndakkoune requested review from ViBiOh and ge0Aja April 17, 2026 13:20
Comment thread aws/logs_monitoring_go/internal/model/forwarder.go Outdated
Comment thread aws/logs_monitoring_go/internal/parsing/s3.go Outdated
scanner := bufio.NewScanner(body)
for scanner.Scan() {
line := scanner.Text()
if rc.multilineRegex != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: these could be on a single line

Comment thread aws/logs_monitoring_go/internal/parsing/s3.go Outdated
@ndakkoune ndakkoune force-pushed the nabil.dakkoune/AWSINTS-3506 branch from 1d9800d to 62ea356 Compare April 17, 2026 15:39
@ndakkoune ndakkoune force-pushed the nabil.dakkoune/AWSINTS-3506 branch from 62ea356 to 3daa8d9 Compare April 17, 2026 20:06
@ndakkoune ndakkoune requested a review from ge0Aja April 17, 2026 20:07
@ndakkoune ndakkoune changed the title [AWSINTS-3506] feat(go-forwarder): add S3 pipeline (with multiline regex), refactor … [AWSINTS-3506] feat(go-forwarder): add S3 pipeline (with multiline regex) Apr 17, 2026
@ndakkoune ndakkoune marked this pull request as ready for review April 20, 2026 09:33
@ndakkoune ndakkoune requested a review from a team as a code owner April 20, 2026 09:33
Comment thread aws/logs_monitoring_go/internal/parsing/s3.go Outdated
@ndakkoune ndakkoune requested a review from ge0Aja April 20, 2026 13:28
Comment thread aws/logs_monitoring_go/internal/parsing/scanner.go
@ndakkoune ndakkoune requested a review from ge0Aja April 20, 2026 16:03
Comment thread aws/logs_monitoring_go/internal/parsing/scanner.go Outdated
@ndakkoune ndakkoune merged commit 2236c14 into nabil.dakkoune/go-forwarder Apr 20, 2026
10 checks passed
@ndakkoune ndakkoune deleted the nabil.dakkoune/AWSINTS-3506 branch April 20, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants