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

system-logs input ignores folders and add tests #41296

Merged
merged 6 commits into from
Oct 22, 2024

Conversation

belimawr
Copy link
Contributor

@belimawr belimawr commented Oct 17, 2024

Note fore reviewers

This PR is not labelled as a bug, but it covers a corner case that wasn't covered before and adds tests, hence I believe it can fall into the "bugfix" category and be backported to 8.16 making it into the 8.16.0 release.

Proposed commit message

The system-logs input now does not count folders as an "existing file"
when looking for files to decide between the journald and log inputs.

Unit and integration tests are added for the system-logs input.

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.

## Disruptive User Impact
## Author's Checklist

How to test this PR locally

cd filebeat
go test -v -count=1 -tags=integration -run=TestSystemLogs ./tests/integration

cd input/systemlogs
go test -v -count=1 ./...

Ideally run those tests on Linux so all of them will execute

Related issues

## Use cases
## Screenshots
## Logs

@belimawr belimawr added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-8.16 Automated backport with mergify labels Oct 17, 2024
@belimawr belimawr self-assigned this Oct 17, 2024
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Oct 17, 2024
Copy link
Contributor

mergify bot commented Oct 17, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Oct 17, 2024
@belimawr belimawr changed the title Implement tests for system-logs input system-logs input ignores folders and add tests Oct 18, 2024
@belimawr belimawr marked this pull request as ready for review October 18, 2024 14:54
@belimawr belimawr requested a review from a team as a code owner October 18, 2024 14:54
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@pierrehilbert pierrehilbert requested review from mauri870 and removed request for khushijain21 October 18, 2024 17:23
system-logs input now ignores directories when checking if files
matching the provided globs exist.
`os.CopyFS` is only available in Go 1.23, so use
`github.com/otiai10/copy` that is already a dependency instead.
@belimawr belimawr force-pushed the 41259-add-tests-for-system-logs branch from 3f28a9c to 511d658 Compare October 22, 2024 15:22
@belimawr belimawr merged commit e82c43c into elastic:main Oct 22, 2024
29 of 30 checks passed
mergify bot pushed a commit that referenced this pull request Oct 22, 2024
The system-logs input now does not count folders as an "existing file"
when looking for files to decide between the journald and log inputs.

Unit and integration tests are added for the system-logs input.

(cherry picked from commit e82c43c)
mergify bot pushed a commit that referenced this pull request Oct 22, 2024
The system-logs input now does not count folders as an "existing file"
when looking for files to decide between the journald and log inputs.

Unit and integration tests are added for the system-logs input.

(cherry picked from commit e82c43c)
pierrehilbert pushed a commit that referenced this pull request Oct 23, 2024
The system-logs input now does not count folders as an "existing file"
when looking for files to decide between the journald and log inputs.

Unit and integration tests are added for the system-logs input.

(cherry picked from commit e82c43c)

Co-authored-by: Tiago Queiroz <[email protected]>
pierrehilbert pushed a commit that referenced this pull request Oct 23, 2024
The system-logs input now does not count folders as an "existing file"
when looking for files to decide between the journald and log inputs.

Unit and integration tests are added for the system-logs input.

(cherry picked from commit e82c43c)

Co-authored-by: Tiago Queiroz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify 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.

Add unit/integration tests for system-logs input
3 participants