diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 1edfb0dc586..6870f16d29f 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -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} diff --git a/auditbeat/module/file_integrity/scanner.go b/auditbeat/module/file_integrity/scanner.go index 6f7bc12a4dc..efd5c5e7a76 100644 --- a/auditbeat/module/file_integrity/scanner.go +++ b/auditbeat/module/file_integrity/scanner.go @@ -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