diff --git a/weed/command/command.go b/weed/command/command.go index 970b44ba2..daa3823a1 100644 --- a/weed/command/command.go +++ b/weed/command/command.go @@ -22,6 +22,7 @@ var Commands = []*Command{ cmdFilerCat, cmdFilerCopy, cmdFilerMetaBackup, + cmdFilerMetaScan, cmdFilerMetaTail, cmdFilerRemoteGateway, cmdFilerRemoteSynchronize, diff --git a/weed/command/filer_meta_scan.go b/weed/command/filer_meta_scan.go new file mode 100644 index 000000000..45305ee84 --- /dev/null +++ b/weed/command/filer_meta_scan.go @@ -0,0 +1,352 @@ +package command + +import ( + "context" + "fmt" + "io" + "os" + "strings" + "time" + + "google.golang.org/grpc" + + "github.com/seaweedfs/seaweedfs/weed/filer" + "github.com/seaweedfs/seaweedfs/weed/pb" + "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" + "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" + "github.com/seaweedfs/seaweedfs/weed/security" + "github.com/seaweedfs/seaweedfs/weed/util" +) + +func init() { + cmdFilerMetaScan.Run = runFilerMetaScan // break init cycle +} + +var cmdFilerMetaScan = &Command{ + UsageLine: "filer.meta.scan -pathPrefix=/some/dir [-since=...] [-until=...]", + Short: "audit what happened under a directory, one line per change", + Long: `Replay the filer's metadata log for one directory and print one line per change. + + Unlike filer.meta.tail this stops when it reaches the end of the requested + range instead of following, so it can be piped straight into grep or awk. + + Each line is: + +