`fly logs` missing some startup logs

Currently I’m using fly machines to run a docker image which executes a test suite. When I run the fly logs command on the machine which should produce lots of log (+1Mb) and then exit, it’s only returning about 100 lines of the generated logs. How can I get the full log output of the execution?

Hi… This is by design, as I understand it: fly logs is mainly intended for viewing logs as they occur (“live tail logs”), and showing a suffix of the previous ones is a bit of an afterthought. Moreover, monitoring on Fly.io (metrics and logs) currently carries the caveat, “Support for this feature is limited and best-effort. Use with caution” in the official docs.

(“use with caution” illustration by Annie Ruygt)

What I usually do is fly logs | tee log.txt, which creates the log.txt file and simultaneously sends things to the terminal (stdout) as they arrive. A person would start this running before the big test suite, of course.

Hope this helps!


Aside: Alternatively, you can try looking in the Grafana-based log search, which is supposed to save everything for 30 days. However, the overall retention chain has been getting wobbly lately—and may be removed entirely in the not-too-distant future.

There is also the possibility of setting up a log shipper (with Vector, etc.), to give yourself more control of the details.

Note that Fly.io’s logs are based on NATS, which, IIRC, doesn’t have formal delivery guarantees. I.e., entries can get lost completely—at least in principle.