diff options
| author | chrislu <chris.lu@gmail.com> | 2022-05-30 22:47:29 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-05-30 22:47:29 -0700 |
| commit | f4a6da6cb276f1891b01097670b044fd4ee6139d (patch) | |
| tree | 8b92c13091e1d9973ce21e4f0c9ac143bd667cfd /weed/command/filer_meta_tail.go | |
| parent | 596c3860cac83a75ae9ce728c8a043133c03d098 (diff) | |
| parent | ca01ce05249c336ed380d9f77efbee68213b8a37 (diff) | |
| download | seaweedfs-f4a6da6cb276f1891b01097670b044fd4ee6139d.tar.xz seaweedfs-f4a6da6cb276f1891b01097670b044fd4ee6139d.zip | |
Merge branch 'master' of https://github.com/chrislusf/seaweedfs
Diffstat (limited to 'weed/command/filer_meta_tail.go')
| -rw-r--r-- | weed/command/filer_meta_tail.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/command/filer_meta_tail.go b/weed/command/filer_meta_tail.go index 7dbeee444..cc3e014c6 100644 --- a/weed/command/filer_meta_tail.go +++ b/weed/command/filer_meta_tail.go @@ -25,6 +25,7 @@ var cmdFilerMetaTail = &Command{ weed filer.meta.tail -timeAgo=30h | grep truncate weed filer.meta.tail -timeAgo=30h | jq . + weed filer.meta.tail -timeAgo=30h -untilTimeAgo=20h | jq . weed filer.meta.tail -timeAgo=30h | jq .eventNotification.newEntry.name weed filer.meta.tail -timeAgo=30h -es=http://<elasticSearchServerHost>:<port> -es.index=seaweedfs @@ -36,6 +37,7 @@ var ( tailFiler = cmdFilerMetaTail.Flag.String("filer", "localhost:8888", "filer hostname:port") tailTarget = cmdFilerMetaTail.Flag.String("pathPrefix", "/", "path to a folder or common prefix for the folders or files on filer") tailStart = cmdFilerMetaTail.Flag.Duration("timeAgo", 0, "start time before now. \"300ms\", \"1.5h\" or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\"") + tailStop = cmdFilerMetaTail.Flag.Duration("untilTimeAgo", 0, "read until this time ago. \"300ms\", \"1.5h\" or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\"") tailPattern = cmdFilerMetaTail.Flag.String("pattern", "", "full path or just filename pattern, ex: \"/home/?opher\", \"*.pdf\", see https://golang.org/pkg/path/filepath/#Match ") esServers = cmdFilerMetaTail.Flag.String("es", "", "comma-separated elastic servers http://<host:port>") esIndex = cmdFilerMetaTail.Flag.String("es.index", "seaweedfs", "ES index name") @@ -103,9 +105,13 @@ func runFilerMetaTail(cmd *Command, args []string) bool { } } - tailErr := pb.FollowMetadata(pb.ServerAddress(*tailFiler), grpcDialOption, "tail", clientId, - *tailTarget, nil, time.Now().Add(-*tailStart).UnixNano(), 0, - func(resp *filer_pb.SubscribeMetadataResponse) error { + var untilTsNs int64 + if *tailStop != 0 { + untilTsNs = time.Now().Add(-*tailStop).UnixNano() + } + + tailErr := pb.FollowMetadata(pb.ServerAddress(*tailFiler), grpcDialOption, "tail", clientId, *tailTarget, nil, + time.Now().Add(-*tailStart).UnixNano(), untilTsNs, 0, func(resp *filer_pb.SubscribeMetadataResponse) error { if !shouldPrint(resp) { return nil } |
