tools/filewatch: add VFS file access tracer with process ancestry - #5547
Open
ElCoyote27 wants to merge 5 commits into
Open
tools/filewatch: add VFS file access tracer with process ancestry#5547ElCoyote27 wants to merge 5 commits into
ElCoyote27 wants to merge 5 commits into
Conversation
ElCoyote27
requested review from
brendangregg,
chenhengqi,
ekyooo and
yonghong-song
as code owners
August 26, 2026 15:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR aims to propose a new script : tools/filewatch
Why this approach
I wrote the filewatch tool (with the help of Cursor AI to do the heavy lifting) to observe files on production systems.
Sometimes, mysterious files pop up in directories, and it's difficult to trace their origin. Sometimes, short-lived files are created and immediately deleted in some shared directories (think /tmp, etc.), making it difficult to attribute ownership.
I am aware that the auditd filesystem, ftrace and bcc's opensnoop / fileslower tools exist but I wanted something to walk back the process to identify rogue processes/tools and that could be used by sysadmins without having to create a custom ad'hoc, script.
The most compelling examples are real-world "mystery solved" scenarios that sysadmins face daily. Here are three that I'd pick for the PR:
This immediately answers "why does my resolv.conf keep reverting?" -- a question that with auditd would require setting up rules, parsing audit.log, and correlating ausearch output.
This shows the full chain: sed was called by a bash wrapper, spawned by Ansible, running over SSH as user deploy. No other tool gives you this in a single command.
This catches temp file churn that would be invisible to lsof (file comes and goes in under a second) and that inotifywait would report without any process information.
And another one (who changed the sudoers global config without using sudo as his/her user?):
Happy to make changes and open to suggestions.
Checklist
tools/toolname:,libbpf-tools/toolname:,src/cc:,docs:,build:,tests/python:)For new tools only
man/man8/) with an OVERHEAD section*_example.txt)tests/python/test_tools_smoke.py