Skip to main content

Read logs and invocations

Find what a function did on a previous run, and read the output it produced.

Prerequisites​

  • An organization owner or admin account, or another cloud user with access to the site. Site users can only look up a run's result by task id.
  • The app and function slugs, or an invocation or task id.

Write output you can read back​

Anything your code prints, writes to standard error, or sends through the logging module is captured onto the run's record. A log helper is also injected for structured entries:

main.py
def main(params, user_data, sdk_client):
log("Syncing invoice", level="info", data={"invoice_id": params.get("invoice_id")})

if not params.get("invoice_id"):
log("Missing invoice_id", level="error")
return {"ok": False}

return {"ok": True}

Entries logged at ERROR or CRITICAL set has_error on the record, which is what makes a failed run findable later. Log deliberately rather than verbosely: a function that logs every iteration of a large loop will lose the entries that mattered.

List runs for one function​

Start here when you know which function you are investigating.

GET/api/apps/$TARUVI_APP_SLUG/functions/$FUNCTION_SLUG/executions/
curl "$TARUVI_SITE_URL/api/apps/$TARUVI_APP_SLUG/functions/$FUNCTION_SLUG/executions/" \
-H "Authorization: Api-Key $TARUVI_API_KEY"

200Returns invocation records for this function. Log output is omitted from the list.

The list shows each run but not its log entries. Open one run to read them.

Read one run in full​

Reading a single invocation through the function-scoped endpoint returns its captured logs and the code that actually ran, which is the fastest way to match a result to the code that produced it.

The endpoint is /api/apps/{app_slug}/functions/{slug}/executions/{execution_id}/.

Find a run when you only have a task id​

An asynchronous execution returns a celery_task_id. Two endpoints accept it:

EndpointReturns
/api/result/{task_id}/The task outcome alone
/api/invocations/by-task-id/{task_id}/The invocation record together with its result

For the request itself, see Execute a function.

Search across the site​

The site-wide invocation list answers questions that span apps, such as which functions failed this morning.

invocations = client.functions.list_invocations(limit=50)

has_error is the most useful of those. It is set when a run logged anything at ERROR or CRITICAL, so it finds runs that reported a problem even when they returned successfully.

warning

These endpoints are scoped to the site, not to an app. They return runs for every app in the site, including their parameters, return values, and log output, to any organization user with access to the site. Don't pass or log secrets or personal data.

Understand what a record contains​

FieldContents
celery_task_idThe handle for result lookups
trigger_typeapi, schedule, or event
history_idWhich version of the code ran
logsStructured log entries, omitted from list responses
log_count, has_errorCounters for filtering without reading the log
task_resultStatus, return value, and traceback

Log entries are ordered by timestamp.

The credentials a function runs with are excluded from these responses.

Know the log limits​

A single execution captures at most 2,000 entries, 1 MiB in total, with individual messages truncated at 10,000 characters. Reaching a limit adds a truncation entry to the log, so a log ending in one is incomplete rather than finished.

Verify​

Execute a function, then find its run and confirm the log output matches what the code produced. If a run you expected is missing, it never started — for event-triggered functions the usual cause is filter conditions that did not match.