Monitor an app¶
This topic describes how to check the state of a running Application
Service, read its logs, metrics, and lifecycle events, and work through common
problems. In Cortex Code CLI
or Cortex Code Desktop, you can
ask the agent to check status, show logs, or diagnose deployment issues. For example:
Show me the logs for my warehouse-monitor app.
Check service status¶
Use SHOW APPLICATION SERVICES to list services you can see, along with their current state, deployed package, and version:
Use DESCRIBE APPLICATION SERVICE to inspect a single service in more detail:
A service can be in one of the following states:
PENDING: the service is starting up.RUNNING: the service is running and can accept requests.SUSPENDING: a suspend is in progress.SUSPENDED: the service is stopped and not consuming compute.FAILED: a container in the service encountered an unrecoverable error.FAILING: the service is transitioning to a failed state.DONE: the service ran to completion (job-style runs only).CANCELLED: a job-style run was cancelled.CANCELLING: a cancel is in progress.DELETING: a drop is in progress.DELETED: the service has been dropped.INTERNAL_ERROR: the service is in an unexpected internal state.
Serverless app status¶
On serverless compute,
the compute_resource column in SHOW APPLICATION SERVICES
output shows SERVERLESS. A serverless app that suspended after its idle period
shows SUSPENDED with current_instances at 0. That’s expected: the next
request starts it again, so you don’t resume it.
Read container logs and telemetry¶
The fastest way to read container logs is with the Snowflake CLI:
By default, the command returns the 500 most recent log lines for the
Application Service defined in your app.yml (--type log). Pass --target
when the manifest defines named targets. Output is
capped at 100 KB.
On managed compute, use --type to select another stream. Serverless apps
support only --type log; see
Serverless app logs.
--since and --until accept relative shorthand such as 30m, 6h, or 2d,
or an absolute UTC timestamp. Metric and lifecycle streams are historical and
default to the last hour when you don’t pass a time window. With --type metric, use --metric cpu, memory, or network, and --raw for
unconverted values.
You can also read live container logs with SQL using SYSTEM$GET_APPLICATION_SERVICE_LOGS. The second argument limits the number of lines returned (default: 500). For a multi-instance service, pass a third argument to choose the instance by its number, starting from 0:
The role that reads logs needs the MONITOR privilege on the service.
Serverless app logs¶
On serverless compute, live logs come from the running instance, so you can
read them only while the app runs. While the app isn’t running, live logs fail
with Failed to retrieve CNG app logs from the orchestrator. To see logs from a
suspended app, open the app to resume it, or read historical logs from the event
table instead:
The function returns the log records as a JSON array.
Serverless apps write logs to the event table, but not metrics or lifecycle
events: the METRIC and EVENT types return no rows, and snow app events
doesn’t support --type metric or --type lifecycle for them. To query the
event table directly, filter on the snow.app.name resource attribute.
Serverless rows also carry snow.database.name, snow.schema.name, and
snow.service.instance, but not snow.application_service.name. See
Snowflake App Runtime limitations.
Read preview logs in Workspaces¶
When you preview an app in a Snowsight workspace (Public Preview), the Preview
pane shows the dev server’s live logs, refreshed every few seconds.
Lines tagged [APP] come from your app’s standard output and standard error.
Lines tagged [PREVIEW] come from the preview itself: sync, install, and status
changes. Until the dev server is up, the pane shows Container not ready.
Preview logs don’t go to an event table.
See Develop Snowflake App Runtime apps in Snowsight Workspaces.
Quick troubleshooting runbook¶
Use this sequence when a deploy or running app looks unhealthy:
-
Check service health:
-
Confirm the service appears in inventory:
-
Pull recent logs quickly:
-
Pull logs with SQL for scripts and worksheets:
-
If
ALTER APPLICATION SERVICE ... RESUMEfails with a blocked runtime image error, upgrade to a new package version before resuming. See Usage notes.
If the service endpoint is not available, run
snow app open --print-only
to check whether the URL is resolvable from the current deployment state.
Use an event table for structured logs¶
For persistent, queryable logs, configure an active event table on your
account and emit structured logs from your application code. The event table
receives logs, metrics, and traces emitted by your containers and by
Snowflake. On serverless compute, the event table receives logs only. For more information, see
Logging, tracing, and metrics. Treat event table
access as sensitive: anyone with SELECT on it can read logs from every
Application Service. Don’t log query results, tokens, or secrets. See
Avoid logging sensitive data
and
Govern log access.
Next steps¶
- Fix common deploy and runtime errors: Troubleshoot Snowflake App Runtime apps.
- See what your apps cost: Cost and credit usage for Snowflake App Runtime.
