Skip to content

[filebeat][gcs][abs] Fix duplicate event IDs for codec-decoded objects - #54157

Merged
efd6 merged 1 commit into
elastic:mainfrom
niladrix719:fix-gcs-codec-event-ids
Nov 15, 2026
Merged

efd6 merged 1 commit into
elastic:mainfrom
niladrix719:fix-gcs-codec-event-ids

Conversation

@niladrix719

@niladrix719 niladrix719 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Proposed commit message

The gcs and azure-blob-storage inputs built each event's _id from evtOffset, which was never incremented. Every record decoded by a codec (CSV, Parquet) from the same object therefore got the same _id and log.offset: 0, and Elasticsearch dropped all but the first as duplicates.

evtOffset is now incremented after each published event, so it holds the record index.

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.

How to test this PR locally

cd x-pack/filebeat
go test -race -run TestDecoding ./input/gcs/ ./input/azureblobstorage/

The new unique-ID assertions fail on main and pass with this change.

Related issues

Use cases

Given a 3-line CSV object in a GCS bucket read with decoding.codec.csv:

  • Before: 1 document is indexed, with log.offset: 0.
  • After: 3 documents are indexed, each with its own _id and log.offset.

@niladrix719
niladrix719 requested a review from a team as a code owner October 28, 2026 11:45
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 28, 2026
@cla-checker-service

cla-checker-service Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

💚 CLA has been signed

@github-actions

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /test : Run the Buildkite pipeline.

@mergify

mergify Bot commented Oct 28, 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 @niladrix719? 🙏.
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.

@niladrix719
niladrix719 force-pushed the fix-gcs-codec-event-ids branch from 5208152 to 1ffcc29 Compare October 28, 2026 12:06
Comment thread x-pack/filebeat/input/gcs/job.go Resolved
@niladrix719
niladrix719 force-pushed the fix-gcs-codec-event-ids branch from 1ffcc29 to 46961f4 Compare November 4, 2026 09:25
@niladrix719
niladrix719 requested a review from efd6 November 4, 2026 09:40
@efd6

efd6 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

/test

@efd6

efd6 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

nit only

Signed-off-by: Niladri Adhikary <niladrix719@gmail.com>
@niladrix719
niladrix719 force-pushed the fix-gcs-codec-event-ids branch from 46961f4 to d4df675 Compare November 9, 2026 09:31
@mergify

mergify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@efd6

efd6 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

/test

@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

@efd6 efd6 added the Team:Security-Service Integrations Security Service Integrations Team label Nov 15, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 15, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

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

@efd6 efd6 added Filebeat Filebeat bugfix backport-8.19 Automated backport to the 8.19 branch backport-9.5 Automated backport to the 9.5 branch backport-9.6 Automated backport to the 9.6 branch labels Nov 15, 2026
@efd6
efd6 merged commit 1ffb1d7 into elastic:main Nov 15, 2026
28 checks passed
efd6 pushed a commit that referenced this pull request Nov 15, 2026
#54157) (#54713)

The gcs and azure-blob-storage inputs built each event's _id from
evtOffset, which was never incremented. Every record decoded by a
codec (CSV, Parquet) from the same object therefore got the same _id
and log.offset: 0, and Elasticsearch dropped all but the first as
duplicates.

evtOffset is now incremented after each published event, so it holds the
record index.

(cherry picked from commit 1ffb1d7)

Co-authored-by: Niladri Adhikary <91966855+niladrix719@users.noreply.github.com>
efd6 pushed a commit that referenced this pull request Nov 15, 2026
#54157) (#54714)

The gcs and azure-blob-storage inputs built each event's _id from
evtOffset, which was never incremented. Every record decoded by a
codec (CSV, Parquet) from the same object therefore got the same _id
and log.offset: 0, and Elasticsearch dropped all but the first as
duplicates.

evtOffset is now incremented after each published event, so it holds the
record index.

(cherry picked from commit 1ffb1d7)

Co-authored-by: Niladri Adhikary <91966855+niladrix719@users.noreply.github.com>
efd6 added a commit that referenced this pull request Nov 16, 2026
…for codec-decoded objects (#54712)

* [filebeat][gcs][abs] Fix duplicate event IDs for codec-decoded objects (#54157)

The gcs and azure-blob-storage inputs built each event's _id from
evtOffset, which was never incremented. Every record decoded by a
codec (CSV, Parquet) from the same object therefore got the same _id
and log.offset: 0, and Elasticsearch dropped all but the first as
duplicates.

evtOffset is now incremented after each published event, so it holds the
record index.

(cherry picked from commit 1ffb1d7)

# Conflicts:
#	x-pack/filebeat/input/azureblobstorage/job.go
#	x-pack/filebeat/input/gcs/job.go

* resolve conflict and remove reference to non-existing Parquet

---------

Co-authored-by: Niladri Adhikary <91966855+niladrix719@users.noreply.github.com>
Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
@vishaangelova vishaangelova mentioned this pull request Nov 23, 2026
1 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.5 Automated backport to the 9.5 branch backport-9.6 Automated backport to the 9.6 branch bugfix Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Filebeat][gcs] All records decoded by a codec (CSV) get the same _id, only the first line of each object is indexed

2 participants