div logs
The log as the run wrote it — stdout on stdout, stderr on stderr, and nothing of ours in between.
div logs training-run-4 -f
div logs run-7 --since 4200
div logs run-7 -f | grep loss
div logs prints a run’s log as the run wrote it: stdout on stdout, stderr on stderr, and nothing of ours in between. div logs run-7 -f | grep loss works, and an agent reading the stream sees only what the container said.
Flags
| Flag | What it does |
|---|---|
-f, --follow |
keep printing until the run stops |
--since <seq> |
start after this line number instead of the beginning |
--limit <n> |
how many lines to print when not following (default and max 500) |
--json |
print the lines as JSON, with their sequence numbers |
Following
Following asks for everything after the last line it printed, once a second — which is how often the control plane writes. A dropped connection costs a pause, then picks up exactly where it left off.
Following a run that has already finished prints what it said and stops. Either way, div logs -f ends with one line on stderr about how the run went, and exits with the run’s own exit code.
Picking up where you left off
Every line has a sequence number. --json shows them; --since starts after one:
div logs run-7 --json | tail -1 # note the last seq
div logs run-7 --since 4200 -f # carry on from there
Without --follow, div logs prints up to --limit lines and returns. It exits with the run’s code if the run has finished, and 0 if it is still going.