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). A refused --rkey lists nothing: see below |
--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 |
A refused --rkey¶
--rkey is judged as a peer’s pattern is (see tranger2_open_list()):
every key of the topic first, with 2 s for all of them, and then the history of
the keys chosen, which takes the time it takes. A pattern that does not
compile, that has a form the judgement refuses ((*COMMIT), (*SKIP), \G,
(*NOTEMPTY_ATSTART), a newline other than LF, (*UCP)), or whose judgements
pass 2 s, lists nothing. tr2list then prints the cause and exits 1. With
--recursive, it prints the cause for each topic, lists the other topics, and
exits 1 at the end. With --follow it prints Cannot follow in place of
Cannot list:
tr2list /yuneta/store/.../topic --rkey='a(*COMMIT)b'
# Cannot list <database>/<topic>: Bad rkey regex 'a(*COMMIT)b': (*COMMIT) is refused in an rkeyUp to 7.31.29 tr2list did not look at the answer. With --follow a refused
list was not seen, and tr2list followed nothing.
Time bounds¶
--from-t, --to-t, --from-tm and --to-tm take an integer or a date,
read by the rule timeranger2 reads a time bound with,
tranger2_time_of_text(), and passed to it as
text: each topic reads it at the open. An integer is the text of a JSON
integer, -?(0|[1-9][0-9]*), used as it is, in the topic’s own unit: seconds, or
milliseconds for t on an sf_t_ms topic and for tm on an sf_tm_ms one.
A date (any form approxidate reads: "2026-10-01", "2 days ago",
"yesterday") is read in seconds and taken to that unit, topic by topic, so
one -r listing over topics of different units cuts them all at the same
instant:
# the records appended on 2026-10-01 (UTC), whatever the unit of t
tr2list /yuneta/store/x/topic1 --from-t="2026-10-01 00:00:00 +0000" --to-t="2026-10-01 23:59:59 +0000"
# the same bound as an integer: seconds on a topic in seconds...
tr2list /yuneta/store/x/topic1 --from-t=1790812800
# ...milliseconds on an sf_t_ms topic
tr2list /yuneta/store/x/topic_ms --from-t=1790812800000A negative integer counts back from the last record of each key, as timeranger2 reads a negative bound:
# the last day of every key (a topic in seconds)
tr2list /yuneta/store/x/topic1 --from-t=-86400A duration with a minus sign is a date, and counts back from NOW, not from
the last record: -1d is the same as 1d or "1 day ago". A key with no
record in the last day lists nothing with -1d, and its last day with
-86400:
# the records of the last 24 hours
tr2list /yuneta/store/x/topic1 --key=user@example.com --from-t=-1dFrom 7.28.5 to 7.28.8 the date reader refused -1d, and tr2list read it as
NOW, with no word: it listed nothing. A date that approxidate cannot read is
refused now, saying why:
tr2list /yuneta/store/x/topic1 --from-t=ayer
# -> TIME of --from-t refused, a text that is no date: 'ayer'Up to 7.27.4 a date stayed in seconds on a topic in milliseconds, and selected
nothing or everything there. Up to 7.27.6 a negative integer was read as a
date, and approxidate read -86400 as NOW (and -1 as the first day of
the month), with no word. --dry-run shows the dates resolved in seconds, and
a negative bound as relative to the last record of each key. An integer out
of range is refused (“an integer past what a time holds”). An empty TIME is
no bound.
A text written as a number that is not the text of a JSON integer is refused,
never read as a date: blanks around it, leading zeros, a +, decimals, an
exponent, a decimal comma (" 5", 007, +5, 10.5, 1E5, 1,5, ,5),
and words that are all digits ("5 5", "2026 10 01", "2026, 10, 01").
So is a text with such numbers among other words: a comma between two digits
("1,5 days ago", September 26 for approxidate), or two or more words of
digits in a row ("5 5 ago", "2026 10 01 10:00"). A run of digits is a
date only as day month year ("01 10 2026") or as a day and a year after the
name of a month ("Oct 1, 2026"). So is a text
that approxidate cannot read (5-, -5-, 5+5, a lone -). Up to 7.27.6
approxidate read +5, " -5", 5+, 5- and -5- as the 5th of this
month, "5 5" and 5+5 as the 5th of May, and a lone - or an empty TIME
as NOW, with no word. Up to 7.29.3, tr2list had a reader of its own, and 007
was 7, 10.5 and 1,5 May 10 and May 1. A - between two digits makes the
text a date, and a date keeps working (2026-10-01, 01.10.2026, and 1.day, which
has a letter):
tr2list /yuneta/store/x/topic1 --from-t=+5
# -> TIME of --from-t refused, a number that is not the text of a JSON integer: '+5'
tr2list /yuneta/store/x/topic1 --from-t=1,5
# -> TIME of --from-t refused, a number that is not the text of a JSON integer: '1,5'
tr2list /yuneta/store/x/topic1 --from-t='5 5'
# -> TIME of --from-t refused, numbers separated by blanks or commas, not a date: '5 5'
tr2list /yuneta/store/x/topic1 --from-t='1,5 days ago'
# -> TIME of --from-t refused, a comma between digits, not a date: '1,5 days ago'
tr2list /yuneta/store/x/topic1 --from-t='01 10 2026 10:00' --dry-run
# -> from_t = 1790841600 (s) -> 2026-10-01T08:00:00.0+0000 (10:00 on a node at +0200)
tr2list /yuneta/store/x/topic1 --from-t=5-
# -> TIME of --from-t refused, a text that is no date: '5-'
tr2list /yuneta/store/x/topic1 --from-t=2026-10-01 --dry-run
# -> from_t = ... 2026-10-01T...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.