Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] keep track of bytes read when max_bytes exceeded #28352

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

leehinman
Copy link
Contributor

What does this PR do?

Keeps track of bytes read when max_bytes is exceeded.

Why is it important?

Without this offset is wrong in the events and the registry. This
leads to re-reading events from the point where max_bytes is
exceeded.

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
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

See #28317

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 11, 2021
@mergify
Copy link
Contributor

mergify bot commented Oct 11, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b 28317_offset_and_max_bytes upstream/28317_offset_and_max_bytes
git merge upstream/master
git push upstream 28317_offset_and_max_bytes

@mergify
Copy link
Contributor

mergify bot commented Oct 11, 2021

This pull request does not have a backport label. Could you fix it @leehinman? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Oct 11, 2021
@leehinman leehinman added backport-v7.16.0 Automated backport with mergify Filebeat Filebeat labels Oct 11, 2021
@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Oct 11, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 11, 2021
@leehinman leehinman added the bug label Oct 11, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 11, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-10-12T19:36:38.656+0000

  • Duration: 151 min 19 sec

  • Commit: 403e576

Test stats 🧪

Test Results
Failed 0
Passed 53759
Skipped 5346
Total 59105

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

@mergify
Copy link
Contributor

mergify bot commented Oct 11, 2021

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b 28317_offset_and_max_bytes upstream/28317_offset_and_max_bytes
git merge upstream/master
git push upstream 28317_offset_and_max_bytes

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

@leehinman Could you try to write some godocs for the Next() method. Without a specification for its behavior I worry that someone might either change the implementation unknowingly or use it incorrectly.

IIUC the int that is returned by LineReader#Next() accumulates the sizes of skipped lines and has little relation to the length of the returned []byte?

@leehinman
Copy link
Contributor Author

@leehinman Could you try to write some godocs for the Next() method. Without a specification for its behavior I worry that someone might either change the implementation unknowingly or use it incorrectly.

IIUC the int that is returned by LineReader#Next() accumulates the sizes of skipped lines and has little relation to the length of the returned []byte?

Good idea. Updated.

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM

@leehinman leehinman merged commit dad462c into elastic:master Oct 13, 2021
mergify bot pushed a commit that referenced this pull request Oct 13, 2021
* [Filebeat] keep track of bytes read when max_bytes exceeded in LineReader

Closes #28317

(cherry picked from commit dad462c)
leehinman added a commit that referenced this pull request Oct 13, 2021
…28379)

* [Filebeat] keep track of bytes read when max_bytes exceeded in LineReader

Closes #28317

(cherry picked from commit dad462c)

Co-authored-by: Lee E Hinman <57081003+leehinman@users.noreply.github.com>
@leehinman leehinman deleted the 28317_offset_and_max_bytes branch October 13, 2021 19:19
Icedroid pushed a commit to Icedroid/beats that referenced this pull request Nov 1, 2021
…28352)

* [Filebeat] keep track of bytes read when max_bytes exceeded in LineReader

Closes elastic#28317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.16.0 Automated backport with mergify bug Filebeat Filebeat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat] offset not correctly recorded when max_bytes is exceeded in linereader
4 participants