Support

How to read logs

View as Markdown

Fetch application logs for a hosting app by environment, source stream, and time range.

Overview

This page covers fetching logs for a hosted app. The logs endpoint returns application output from both PREVIEW and PUBLISH environments and supports filtering by source stream (STDOUT or STDERR), severity level, and time range. By default, logs return the last 24 hours; you can request up to 7 days in the past.

Go to Deploy your Node.js app if you haven't created and deployed an app yet. Go to Troubleshoot Hosting for guidance on diagnosing specific failures. For the complete list of query parameters and response schema, see Logs API reference.

Prerequisites

The following prerequisites are required before you can read logs for your app:

Get logs

The following procedure fetches all logs from the PREVIEW variant (default).

  • Fetch logs from PREVIEW:

    curl -s "$BASE_URL/v1/hosting/apps/$APP_ID/logs" \
      -H "Authorization: Bearer $GODADDY_PAT" | jq .

Read production logs

The following procedure fetches all logs from the PUBLISH variant. Every app has two parallel variants: PREVIEW (working copy) and PUBLISH (live traffic). Go to Hosting concepts for more information.

  • Fetch production logs:

    curl -s "$BASE_URL/v1/hosting/apps/$APP_ID/logs?variant=PUBLISH" \
      -H "Authorization: Bearer $GODADDY_PAT" | jq .

Filter by severity level

The following procedure fetches only error-level logs.

  • Fetch error logs:

    curl -s "$BASE_URL/v1/hosting/apps/$APP_ID/logs?level=ERROR" \
      -H "Authorization: Bearer $GODADDY_PAT" | jq .

Filter by time range

The following procedure fetches logs written at or after a specific timestamp.

  • Fetch logs since the timestamp:

    curl -s "$BASE_URL/v1/hosting/apps/$APP_ID/logs?since=2024-01-15T10:00:00Z" \
      -H "Authorization: Bearer $GODADDY_PAT" | jq .

Common errors

The following table lists common errors and recommended actions:

StatusCauseAction
401Expired or revoked PAT, or missing scopeConfirm the token includes hosting.log:read
404App id not foundConfirm the id from GET /apps
400Invalid parameter valueUse uppercase for variant (PREVIEW or PUBLISH), source (STDOUT or STDERR), and level (INFO, WARN, ERROR)
429Rate limit exceededBack off and retry. Go to Rate limits for handling guidance

Agent & Automation Notes

Scopeshosting.log:read
Rate limit60 req/min per credential
IdempotentYes
DestructiveNo
On failureLog reads are safe to retry. Empty response means no logs match the filters — adjust source, since, or variant.

Last updated on

How is this guide?

On this page