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

[7.15](backport #27722) [Auditbeat] scanner honor include_files #27844

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- system/package: Fix an error that can occur while trying to persist package metadata. {issue}18536[18536] {pull}18887[18887]
- system/socket: Fix dataset using 100% CPU and becoming unresponsive in some scenarios. {pull}19033[19033] {pull}19764[19764]
- system/socket: Fixed tracking of long-running connections. {pull}19033[19033]
- file_integrity: honor include_files when doing initial scan. {issue}27273[27273] {pull}27722[27722]

*Filebeat*

Expand Down
2 changes: 1 addition & 1 deletion auditbeat/module/file_integrity/metricset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func TestIncludedExcludedFiles(t *testing.T) {
}

config := getConfig(dir)
config["include_files"] = []string{`\.ssh/`}
config["include_files"] = []string{`\.ssh`}
config["recursive"] = true
ms := mbtest.NewPushMetricSetV2(t, config)

Expand Down
5 changes: 5 additions & 0 deletions auditbeat/module/file_integrity/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ func (s *scanner) walkDir(dir string, action Action) error {
}
return nil
}

if !info.IsDir() && !s.config.IsIncludedPath(path) {
return nil
}

defer func() { startTime = time.Now() }()

event := s.newScanEvent(path, info, err, action)
Expand Down