Skip to content

Instantly share code, notes, and snippets.

@luckman212
Last active February 12, 2024 00:26
Show Gist options
  • Save luckman212/4bb90c65a3470cb11fba49e694dc205f to your computer and use it in GitHub Desktop.
Save luckman212/4bb90c65a3470cb11fba49e694dc205f to your computer and use it in GitHub Desktop.
macOS script to log xattr changes in realtime, requires `jq`
#!/usr/bin/env bash
# watches for changes to xattrs and utimes
# https://github.com/syncthing/syncthing/issues/9371#issuecomment-1937696552
# https://gist.github.com/luckman212/4bb90c65a3470cb11fba49e694dc205f
sudo eslogger --format json setextattr deleteextattr setattrlist utimes | jq -r '
.event as $e |
.process as $p |
($e | keys[0]) as $t |
($p | .executable? | (.path? | split("/")[-1] )) as $x |
[.time, $t, $x, ($e[$t].extattr // ($e[$t].attrlist?|keys?|join(","))), ([($e[$t].target.path),($e[$t].mtime//empty)]|join("->"))] |
@tsv'
@luckman212
Copy link
Author

@luckman212
Copy link
Author

Added utimes / mtime logging

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