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

Check err param in filepath.WalkFunc #6007

Merged
merged 1 commit into from
Jan 7, 2018
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
@@ -59,6 +59,9 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di

*Auditbeat*

- Add an error check to the file integrity scanner to prevent a panic when
there is an error reading file info via lstat. {issue}6005[6005]

*Filebeat*

- Add support for adding string tags {pull}5395{5395}
8 changes: 8 additions & 0 deletions auditbeat/module/file_integrity/scanner.go
Original file line number Diff line number Diff line change
@@ -101,6 +101,14 @@ func (s *scanner) walkDir(dir string) error {
errDone := errors.New("done")
startTime := time.Now()
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
if !os.IsNotExist(err) {
s.log.Warnw("Scanner is skipping a path because of an error",
"file_path", path, "error", err)
}
return nil
}

if s.config.IsExcludedPath(path) {
if info.IsDir() {
return filepath.SkipDir