How a log is captured
The supervisor streams the function’s stderr to the host over vsock as the function writes it. A write blocks while the host is not reading. The host sends each piece two ways at once:- to NATS, on
logs.<tenant>.<invocation>for the first attempt andlogs.<tenant>.<invocation>.<attempt>for later ones, where theLOGSstream keeps the latest pieces for live and recent reads, - to the logs bucket, gzipped and uploaded in 5 MiB parts, completed when the attempt ends.
Live logs on NATS
TheLOGS stream lives in memory. The bucket is what keeps logs, so a NATS
restart loses nothing a finished invocation needs.
Without a logs bucket (
LOGS_BUCKET unset), the stream is the only copy, and a
log is gone once the stream drops it.
The logs bucket
LOGS_BUCKET is a bucket URL: s3://, gs:// or file://. Each attempt’s log
is one gzipped object, keyed by tenant, function and the UTC day the invocation
was created, so one prefix lists a function’s logs for a day:
.out object holds the output of a call that carried an idempotency key, so
a later call with the key can replay it. Only keyed calls write one.
Alchemy never deletes from the bucket. Use the bucket’s own lifecycle rules to
move old logs to colder storage or expire them.
Reading logs
GetInvocationLogs streams one attempt’s log, the latest by default or the one
attempt names, counting from 1. Pieces arrive in order but are not split on
line boundaries.
- An attempt that has ended is read from the bucket.
- An attempt still running, or one whose upload has not completed, is read from the stream, which holds only its latest pieces.
- With
follow, the call stays open while the attempt runs and ends when it does.