List the records of a timeranger2 topic, with rich filtering, field
selection, metadata, and local-time output. The topic/database are deduced from
the PATH.
Usage¶
tr2list PATH [options]tr2list /yuneta/store/.../topic --from-rowid -10 # last 10 records
tr2list /yuneta/store/.../topic --key mykey --mode table
tr2list /yuneta/store/.../topic --follow # tail -fOptions¶
| Option | Purpose |
|---|---|
--key / --not-key / --rkey | Match by key (exact / negated / regex) |
--from-t / --to-t | Record-time range |
--from-tm / --to-tm | Message-time range |
--from-rowid / --to-rowid | Rowid range (negative = from the end) |
--user-flag-set / --system-flag-set (+ …-not-set) | Flag filters |
--filter | JSON dict of field matches; each key is a PATH (see below) |
--fields | Select output fields |
--mode form|table | Output layout |
--show_md2 | Include __md2__ metadata |
--print-local-time / -t | Local timestamps |
--recursive / -r | Walk subtopics |
--follow / -F | Live tail (not with -r) |
--dry-run / -n | Resolve and print the plan only |
--list-databases | List databases under the path |
--verbose / -l | Verbosity level |
Filtering by field¶
--filter takes a JSON dict. A record is listed when every key of the dict,
read as a path into the record (segments joined by `), holds exactly
the value given. A key without ` is a top-level field:
# records whose top-level field "state" is "on"
tr2list /yuneta/store/x/topic1 --filter='{"state": "on"}'
# records whose nested field device.model is "T-100", AND state is "on"
tr2list /yuneta/store/x/topic1 --filter='{"device`model": "T-100", "state": "on"}'For the record {"state": "on", "device": {"model": "T-100", "fw": 3}} both
filters match. The value is compared whole: {"device": {"model": "T-100"}}
does NOT match it, because device also holds fw — name the leaf with a
path instead.