-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Auditbeat/FIM/fsnotify]: prevent losing events for recursive mode on OS X #39362
[Auditbeat/FIM/fsnotify]: prevent losing events for recursive mode on OS X #39362
Conversation
33504f4
to
dbfd308
Compare
Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if it works.
run docs-build |
This pull request is now in conflicts. Could you fix it? 🙏
|
…causes losing events on mac
dbfd308
to
8ed3203
Compare
…ts for recursive mode on OS X (#39374) * [Auditbeat/FIM/fsnotify]: prevent losing events for recursive mode on OS X (#39362) * fix(auditbeat/fim/fsnotify): do not return error immediately as this causes losing events on mac * doc: update CHANGELOG.next.asciidoc (cherry picked from commit bbf8746) * doc: remove redundant changes from CHANGELOG.next.asciidoc --------- Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
Proposed commit message
This PR prevents FIM from losing events for recursive mode on Mac OS X even when the
watchFile
of the root dir, added to be monitored, returns an error by always walking the dir. Specifically, this discrepancy, between Linux and OS X oses, is due to the fact that in the latter the underlying library, namely fsnotify, when you add a watch of a directory it walks the directory and adds the respective sub-dir watchers. If any of these fail, e.g. with EACCESS, it returns an error. However, auditbeat's wrapper of this library emits created events by walking the directory. So, in order not to lose any events we need to guarantee that we won't interrupt this flow - we will always walk the directory - and accumulate any errors during this process which we will return only at the end.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
N/A
How to test this PR locally
Already tested here
Related issues
Use cases
N/A
Screenshots
N/A
Logs
N/A