Skip to content

[logptest] Fix Logger.FindInLogs handling of partial lines#388

Merged
belimawr merged 2 commits intoelastic:mainfrom
belimawr:fix-FindInLogs-offset-handling
Mar 2, 2026
Merged

[logptest] Fix Logger.FindInLogs handling of partial lines#388
belimawr merged 2 commits intoelastic:mainfrom
belimawr:fix-FindInLogs-offset-handling

Conversation

@belimawr
Copy link
Copy Markdown
Contributor

What does this PR do?

When Logger.FindInLogs read a partial line (EOF reached before reading EOL ('\n')) the offset would be updated, this could cause some strings never to be matched because they had been partially read.

This commit fixes it by only advancing the offset if a full line has been read.

GenAI-Assisted: Yes
Human-Reviewed: Yes
Tool: GitHub Copilot CLI, Model: GPT-5.3 Codex

Why is it important?

It fixes a bug: elastic/beats#49144

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

## Author's Checklist

Related issues

When Logger.FindInLogs read a partial line (EOF reached before reading
EOL ('\n')) the offset would be updated, this could cause some strings
never to be matched because they had been partially read.

This commit fixes it by only advancing the offset if a full line has
been read.

GenAI-Assisted: Yes
Human-Reviewed: Yes
Tool: GitHub Copilot CLI, Model: GPT-5.3 Codex
@belimawr belimawr self-assigned this Feb 27, 2026
@belimawr belimawr added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Feb 27, 2026
GenAI-Assisted: Yes
Human-Reviewed: Yes
Tool: GitHub Copilot CLI, Model: GPT-5.3 Codex
@belimawr belimawr marked this pull request as ready for review February 27, 2026 17:43
@belimawr belimawr requested a review from a team as a code owner February 27, 2026 17:43
@belimawr belimawr requested review from khushijain21 and mauri870 and removed request for a team February 27, 2026 17:43
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

cc @belimawr

Copy link
Copy Markdown
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

This looks fine but the reason it happened seems to be that we have chosen the hard way to implement this and it would be nice to change that.

@belimawr belimawr merged commit 4ac616c into elastic:main Mar 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flaky Test] TestDataAddedAfterCloseInactive: missing 'file is inactive' logs

5 participants