Skip to content

x-pack/filebeat/input/awss3: Add lexicographical polling mode#48310

Merged
kcreddy merged 35 commits into
elastic:mainfrom
kcreddy:aws-s3-lexico
Feb 16, 2026
Merged

x-pack/filebeat/input/awss3: Add lexicographical polling mode#48310
kcreddy merged 35 commits into
elastic:mainfrom
kcreddy:aws-s3-lexico

Conversation

@kcreddy

@kcreddy kcreddy commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Proposed commit message

x-pack/filebeat/input/awss3: Add lexicographical polling mode

Adds lexicographical ordering mode for S3 bucket polling. 
The input uses the S3 "StartAfter" parameter to resume listing.
For buckets with a large number of objects where object keys 
are naturally ordered (ex: timestamp-prefixed), this significantly 
reduces the number of objects listed [1] and memory footprint.

The persisted tail key tracks in-flight objects for crash resistance,
ensuring no objects are skipped after an unexpected restart.

Adds 2 new configuration options "lexicographical_ordering" and 
"lexicographical_lookback_keys":
- lexicographical_ordering: When set to "true", enables 
  lexicographical ordering mode. Default is "false".
- lexicographical_lookback_keys: Maintains a bounded lookback 
  buffer of the N most recently processed keys (default: 100). The 
  start-after parameter uses the lexicographically oldest key in 
  the buffer, creating a sliding window that catches late-arriving 
  objects.

[1] https://github.com/elastic/beats/issues/47926#issuecomment-3713381444

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

How to test this PR locally

Related issues

Use cases

@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 6, 2026
@github-actions

github-actions Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify mergify Bot assigned kcreddy Jan 6, 2026
@mergify

mergify Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @kcreddy? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@github-actions

github-actions Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

🔍 Preview links for changed docs

@kcreddy kcreddy marked this pull request as ready for review January 6, 2026 19:41
@kcreddy kcreddy requested review from a team as code owners January 6, 2026 19:41
@kcreddy kcreddy requested a review from andrewkroh January 6, 2026 19:41
@kcreddy kcreddy added enhancement Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team labels Jan 6, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 6, 2026
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

Comment thread docs/reference/filebeat/filebeat-input-aws-s3.md
Comment thread docs/reference/filebeat/filebeat-input-aws-s3.md
@kcreddy kcreddy requested a review from bmorelli25 January 8, 2026 08:07
Comment thread x-pack/filebeat/input/awss3/states.go Outdated

@Kavindu-Dodan Kavindu-Dodan left a comment

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.

@kcreddy thanks again for the update and working on this.

I left few more remarks and we are almost there 🙌

Comment thread x-pack/filebeat/input/awss3/states.go
Comment thread x-pack/filebeat/input/awss3/states.go Outdated
@github-actions

github-actions Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

✅ Vale Linting Results

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide.

To use Vale locally or report issues, refer to Elastic style guide for Vale.

@Kavindu-Dodan Kavindu-Dodan left a comment

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.

Overall looks good, but please check the current lint failures to get a green build - https://github.com/elastic/beats/actions/runs/21706571563/job/62599113313?pr=48310#step:5:38

@efd6

efd6 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

The remaining lint complaints are all "Error return value is not checked (errcheck)". This because of this. I do not believe that option should be true; there are numerous cases (for example to cases that are flagged here) where a direct panic from (runtime.panicdottypeE or runtime.panicnildottype) is the correct action for the program to take because of a failed type assertion. To work around the repo policy, I think it would be best to add a //nolint:errcheck // some reason to the relevant lines.

@kcreddy kcreddy requested a review from Kavindu-Dodan February 6, 2026 04:53

@Kavindu-Dodan Kavindu-Dodan left a comment

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.

Unfortunately, the actual runtime state registry expects a map or an object as state value. So we must fix this and validate if beats input work end to end.

Comment thread x-pack/filebeat/input/awss3/states.go Outdated
@kcreddy kcreddy requested a review from Kavindu-Dodan February 9, 2026 08:41
Comment thread x-pack/filebeat/input/awss3/states.go Outdated
@kcreddy kcreddy requested a review from efd6 February 10, 2026 08:55

@efd6 efd6 left a comment

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.

nits/queries only

Comment thread x-pack/filebeat/input/awss3/config.go Outdated
Comment thread x-pack/filebeat/input/awss3/interfaces.go Outdated
Comment thread x-pack/filebeat/input/awss3/polling_strategy.go Outdated
@kcreddy kcreddy requested a review from efd6 February 11, 2026 14:50

@efd6 efd6 left a comment

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.

Thanks

Comment thread x-pack/filebeat/input/awss3/states.go Outdated
@Kavindu-Dodan Kavindu-Dodan self-requested a review February 13, 2026 18:08

@Kavindu-Dodan Kavindu-Dodan left a comment

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.

I have this concern which must be checked and added - #48310 (comment)

Otherwise, my local run went fine and I can clearly see the benefit of this feature. I am approving to unblock once above concern is fixed.

@kcreddy kcreddy merged commit d17c140 into elastic:main Feb 16, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Filebeat]: aws-s3 input - Add Lexicographical Ordering Mode

6 participants