Skip to content

Windows USN Journals #53

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

Open
nathany opened this issue Nov 16, 2014 · 15 comments
Open

Windows USN Journals #53

nathany opened this issue Nov 16, 2014 · 15 comments

Comments

@nathany
Copy link
Contributor

nathany commented Nov 16, 2014

@pkrnjevic mentioned Windows USN Journals here: fsnotify/fsevents#1 (comment)

"On Windows NT 4.0, these tasks were accomplished with functions like FindFirstChangeNotification and ReadDirectoryChangesW. Anyone who has attempted to use these functions knows how limited they can be. The Change Journal provides a new level of detailed information for applications that need to monitor changes on an NTFS volume."

@nathany

This comment was marked as outdated.

@nathany
Copy link
Contributor Author

nathany commented Nov 16, 2014

FYI, Go currently requires Windows XP or later, so there is no need to support anything older than that.

@pkrnjevic
Copy link

For those interested, here is a small example of using Windows Journals I wrote in Go, based on the MSJ Windows Change Journal article and sample.
I can confirm this works with Windows 7 (32 bit) with Go 1.3.3. Must be run with Administrator privileges.

@nathany
Copy link
Contributor Author

nathany commented Nov 19, 2014

Is it possible to use USN Journals without Administrator privileges?

@pkrnjevic
Copy link

pkrnjevic commented Nov 19, 2014

Not that I know of.
My plan was to use it in a Windows service, with a user space client interface, though there are probably better ideas.

@nathany

This comment was marked as outdated.

@hktk1f40

This comment was marked as off-topic.

@nathany

This comment was marked as off-topic.

@stevenb256

This comment was marked as off-topic.

@nathany

This comment was marked as outdated.

@elvarb
Copy link

elvarb commented May 17, 2016

Would love for this to get implemented, such a powerful feature.

Found this that could be of help.
https://blogs.technet.microsoft.com/heyscriptingguy/2015/08/12/use-poshusnjournal-module-to-work-with-change-journal/

@nathany

This comment was marked as outdated.

@arp242
Copy link
Member

arp242 commented Oct 15, 2022

To add this to fsnotify adding support for it in x/sys/windows would be required first. The example that was posted earlier would be a good starting point for that.

Change Journals on the Microsoft site gives a nice general overview on how it works, how to use it from the fsutil, and how to use it programmatically.

@mweibel
Copy link

mweibel commented Mar 25, 2025

FYI I worked briefly on an implementation for an USN backend for fsnotify but I just stopped working on it due to the fact that USN journals don't seem to work in windows containers.

If anyone is willing to test and improve on my initial implementation, feel free:
helio@f29508c

@arp242
Copy link
Member

arp242 commented Apr 1, 2025

If anyone is willing to test and improve on my initial implementation, feel free: helio@f29508c

I pushed a slightly updated version of that in https://github.com/fsnotify/fsnotify/tree/usn – just a few formatting/style fixes, haven't even tried to run it beyond "it compiles". Won't work on it any time soon, but just wanted to save it somewhere in case the fork gets deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants