What you will be able to do
- Query event table data for system health indicators and for user and role activity
- Create scheduled alerts and alerts on new data that act on event table rows without duplicate notifications
- Use spans, span events and logs to find the cause of a failure or a slow UDF
1.Reading event tables for health and user activity
An event table is a special kind of table with predefined columns, where Snowflake collects telemetry from procedures, UDFs and other objects: log messages, trace events and metrics. It collects data only while it is the active event table and the level parameters allow it. LOG_LEVEL sets the minimum severity of log messages that are kept, and LOG_EVENT_LEVEL does the same for log events. Once those conditions hold, every row the table holds is evidence you can query, which is what makes failures, slowdowns and unusual activity visible after the fact. Snowsight's Monitoring » Traces & logs page lists logs and traces and lets you filter by date range, user, severity, language, trace status and database. The same data can be read directly with SELECT on the event table.
Health indicators show up in three places in the data:
- Trace status: a trace is the record of the calls a query made through your handler code, and a span is one timed unit of work inside it, with its own ID, a parent span ID and a duration. Snowsight marks a trace Error if it reported errors and Success otherwise, and counts its spans.
- Metrics: the Related Metrics tab charts CPU and memory use for Snowpark Python stored procedures and UDFs.
- Log events (record type EVENT): Snowpipe, tasks, dynamic tables, Snowpark Container Services compute pools and Iceberg tables write these, so a failed refresh or load shows up next to your own logs.
The RESOURCE_ATTRIBUTES column records who did what, so the event table doubles as an activity record. db.user is the user who ran the function or procedure. snow.session.role.primary.name is the session's primary role, and snow.owner.name is the role that owns the executable. snow.query.id is the query that triggered the work, and snow.warehouse.name is the warehouse that ran it. Data governance tag activity also arrives as log events once LOG_EVENT_LEVEL allows it. Filtering on these attributes tells you which users and roles ran a given procedure, and which roles ran code they don't own. That is the starting point for access reviews and for spotting unusual activity.
Checkpoint 1 of 4· Match them up
You are reviewing who ran a stored procedure, using the RESOURCE_ATTRIBUTES column of the event table. Match each attribute to what it records.
Tap a term, then the definition that fits it.
snow.session.role.primary.name is the role that made the call, and snow.owner.name is the role that owns the code. Comparing the two shows which roles ran code they don't own, which is a starting point for access reviews. db.user and snow.query.id tie each row to a person and a specific query.
“The name of the role with OWNERSHIP privilege for the executable. Retrieved from the RESOURCE_ATTRIBUTES column snow.owner.name value.”Source: docs.snowflake.com
2.Alerts that act on event table data
Event table data only helps if someone looks at it, and an alert does the looking for you. An alert has a condition, an action and a schedule. Usually the condition is a SQL query, such as one that checks for ERROR rows. The action usually sends a notification by email, cloud provider queue, Slack, PagerDuty or Microsoft Teams. An alert needs compute to run: either a virtual warehouse you name or the serverless model, where Snowflake sizes the compute from recent runs. Inside the action, SNOWFLAKE.ALERT.GET_CONDITION_QUERY_UUID() passed to RESULT_SCAN gives you the rows the condition found, so the notification can say what went wrong.
A scheduled alert that runs repeatedly should bound its window with the alert's own schedule, not the wall clock. SNOWFLAKE.ALERT.SCHEDULED_TIME() returns when the current run was scheduled. SNOWFLAKE.ALERT.LAST_SUCCESSFUL_SCHEDULED_TIME() returns when the last successful evaluation was scheduled. Together they cover every row exactly once. Both functions work only inside an alert, and the alert's role needs the SNOWFLAKE.ALERT_VIEWER database role. On the very first run there is no earlier success, so the function returns the UNIX epoch, which means the first window covers all existing rows.
CREATE OR REPLACE ALERT alert_new_rows
WAREHOUSE = my_warehouse
SCHEDULE = '1 MINUTE'
IF (EXISTS (
SELECT *
FROM my_table
WHERE row_timestamp BETWEEN SNOWFLAKE.ALERT.LAST_SUCCESSFUL_SCHEDULED_TIME()
AND SNOWFLAKE.ALERT.SCHEDULED_TIME()
))
THEN CALL SYSTEM$SEND_EMAIL(...);The other option is an alert on new data. It runs whenever rows are inserted and evaluates its condition against only those new rows, so duplicates can't happen by design. An event table works as its source, which makes this a good fit for something like notifying Slack when a dynamic table refresh fails. The trade-off is a narrower condition, summarized below.
| Aspect | Scheduled alert | Alert on new data |
|---|---|---|
| When it runs | On a fixed schedule, whether or not data was added | Whenever new rows are inserted |
| Rows evaluated | Whatever the condition selects; bound with SCHEDULED_TIME functions | Only the newly inserted rows |
| Condition limits | Full SQL condition | One table, view or event table in FROM; change tracking required; no CTEs, DML, procedure calls or joins |
| Manual run with EXECUTE ALERT | Supported | Not supported |
Use an alert on new data when a single newly inserted row should trigger action and the check fits in one table. Use a scheduled alert when the condition needs joins, aggregates over time, or a manual test run with EXECUTE ALERT. Remember that change tracking is a requirement for alerts on new data only. It plays no part in getting telemetry into an event table.
Checkpoint 2 of 4· Check yourself
A team runs CREATE EVENT TABLE ops.mon.events and sets LOG_LEVEL = ERROR on the account. They then create an alert on new data that reads ops.mon.events and posts to Slack whenever an ERROR row arrives, and they turn on change tracking. Procedures keep logging errors, but the alert never fires and ops.mon.events stays empty. What fixes it?
Telemetry is stored only in an active event table, and creating a table doesn't make it active. Until EVENT_TABLE points at ops.mon.events, rows keep going to SNOWFLAKE.TELEMETRY.EVENTS, so the alert never sees an insert. Change tracking doesn't help here. Alerts on new data can read event tables. EXECUTE ALERT isn't supported for this alert type, and granting INSERT to the procedure owners doesn't change where their telemetry goes.
“To collect telemetry data, you must have an active event table and have set telemetry levels to allow data collection.”Source: docs.snowflake.com
Checkpoint 3 of 4· Exam question
An administrator ran CREATE EVENT TABLE monitoring.logs.app_events and set LOG_LEVEL = INFO at the account level. Python procedures call logging.info, but no rows ever appear in monitoring.logs.app_events. What is missing?
Correct answer: D — Run ALTER ACCOUNT SET EVENT_TABLE = monitoring.logs.app_events as ACCOUNTADMIN so collection is redirected away from the default table.
- A. Incorrect. Snowflake writes telemetry itself, so procedure owners never need INSERT on the event table, and granting it would not change where records are collected.
- B. Incorrect. Change tracking supports streams on the table but has no effect on which event table receives telemetry from handler code.
- C. Incorrect. EVENT_TABLE is set at the account (or database) level and is not a session parameter that individual users can set.
- D. Correct. Creating an event table does not activate it; until ALTER ACCOUNT SET EVENT_TABLE points to it, telemetry continues to land in the default SNOWFLAKE.TELEMETRY.EVENTS table.
3.Root cause analysis and tuning with traces
Logs and traces answer different questions, and root cause analysis uses both. A log entry is a plain string recording what one invocation was doing. A trace event is a structured, queryable summary that is grouped into spans.
| Characteristic | Log entries | Trace events |
|---|---|---|
| Payload | A string, with no structure | Key-value attributes |
| Grouping | None; each entry stands alone | Organised into spans, which have their own attributes |
| Quantity limits | Unlimited | At most 128 trace events per span; span attributes are also limited |
| Query effort | High: each entry must be parsed | Low: attributes are queried directly |
A failure investigation usually goes from the trace down to the logs. Start with traces whose status is Error. Open the Trace Details page and walk the spans. Each span has a span ID, a parent span ID, a duration, a status code and any attributes your code added, so you can see which nested call failed. The span's query ID and RESOURCE_ATTRIBUTES then lead you to the log messages emitted by the same query. Those logs carry the detail the span leaves out. In the event table itself, SPAN rows give the span's name and status in RECORD, and SPAN_EVENT rows record checkpoints inside it, such as test_udtf_process with its input.
Span durations are also a tuning tool, especially for UDFs. Snowflake runs a UDF in parallel, with a handler instance per input row, and each instance shows up as its own span. If a few spans take far longer than the rest, those instances probably received unusually large rows or an uneven share of the input partitioning. The fix belongs in the data or the partitioning, not in a bigger warehouse. For a Snowpark Python procedure or UDF, check the CPU and memory charts on Related Metrics against the slow span. Operator-level detail for a query lives in the Query Profile.
The same per-row model is why UDF logging needs care. A UDF that logs on every row of a 10-million-row input writes 10 million log entries. Instrument with DEBUG and INFO statements but run production at WARN. Lower the level only while you debug, and wrap noisy code in conditions or try/catch blocks so only meaningful cases get logged.
Checkpoint 4 of 4· Check yourself
A stored procedure currently writes one free-text log string per invocation. Analysts now want plain SQL that counts, across thousands of invocations, how often each code branch ran and which input value each call received. Which change best serves that goal?
Trace events carry structured key-value attributes, grouped into spans, so you can query them and aggregate across invocations directly. Each log entry is an unstructured string that every query has to parse. Lowering the log level only adds more unstructured text, and metrics cover only CPU and memory.
“Structured with attributes you can attach to trace events. Attributes are key-value pairs that can be easily queried with a SQL query.”Source: docs.snowflake.com
Practise it for real
Route telemetry to a custom event table, get detailed logs from one procedure, and alert on errors without duplicate notifications.
1.Run CREATE EVENT TABLE my_database.my_schema.my_events; then, as ACCOUNTADMIN, ALTER ACCOUNT SET EVENT_TABLE = my_database.my_schema.my_events;
Why: Creating the table alone doesn't redirect collection. The account-level EVENT_TABLE parameter does.
You should see: SHOW PARAMETERS LIKE 'event_table' IN ACCOUNT shows my_database.my_schema.my_events.
2.Set LOG_LEVEL = ERROR on the account, then set LOG_LEVEL = DEBUG on one procedure with ALTER PROCEDURE.
Why: The object-level setting overrides the account default for that procedure only.
You should see: After you call the procedure, its DEBUG messages appear in the event table; other handlers record only ERROR and FATAL.
3.Query the event table for that procedure's rows and read RESOURCE_ATTRIBUTES for db.user, snow.session.role.primary.name and snow.query.id.
Why: These attributes link each log line to a user, a role and a query.
You should see: Rows show your user, your active role and the query ID of the call.
4.Grant SNOWFLAKE.ALERT_VIEWER to the alert's role, then create a scheduled alert whose condition looks for ERROR rows with a timestamp BETWEEN SNOWFLAKE.ALERT.LAST_SUCCESSFUL_SCHEDULED_TIME() AND SNOWFLAKE.ALERT.SCHEDULED_TIME().
Why: Bounding the window by the schedule means each error row is evaluated exactly once.
You should see: Each new error triggers a single notification, and later runs don't repeat it.
Stuck? Get a nudge
If the alert fires on its first run for old rows, that is expected: with no earlier successful run, LAST_SUCCESSFUL_SCHEDULED_TIME returns the UNIX epoch.
Sources
(8)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“An event table is a special kind of database table with a predefined set of columns.”
↩︎ Reading event tables for health and user activity“To collect telemetry data, you must have an active event table and have set telemetry levels to allow data collection.”
↩︎ Checkpoint - 2.
“Unique ID of the span containing the selected span.”
↩︎ Reading event tables for health and user activity“Error if the trace reported errors; otherwise, Success.”
↩︎ Reading event tables for health and user activity“Displays charts illustrating CPU and memory metrics for resource consumption by Snowpark Python stored procedures and UDFs.”
↩︎ Reading event tables for health and user activity“The name of the user executing the function or procedure.”
↩︎ Reading event tables for health and user activity“A span object contains trace events.”
↩︎ Root cause analysis and tuning with traces“The name of the role with OWNERSHIP privilege for the executable. Retrieved from the RESOURCE_ATTRIBUTES column snow.owner.name value.”
↩︎ Checkpoint - 3.
“Examples include events from Snowpipe, tasks, dynamic tables, Snowpark Container Services compute pools, Iceberg tables, and data governance tag activity.”
↩︎ Reading event tables for health and user activity - 4.
“Snowflake supports sending notifications to email, cloud service provider queues, Slack, PagerDuty, and Microsoft Teams.”
↩︎ Alerts that act on event table data“that instance might take much longer to complete, and therefore its span is much longer.”
↩︎ Root cause analysis and tuning with traces“Use DEBUG- or INFO-level logging statements and set the logging level to WARN in production.”
↩︎ Root cause analysis and tuning with traces“specify alert timestamps using SCHEDULED_TIME and LAST_SUCCESSFUL_SCHEDULED_TIME instead of using CURRENT_TIMESTAMP.”
↩︎ Exam trap 1 - 5.https://docs.snowflake.com/en/user-guide/alertsOfficial docs
“An alert requires a warehouse for execution. You can either use the serverless compute model or a virtual warehouse that you specify.”
↩︎ Alerts that act on event table data“Whenever new rows are inserted, the alert executes, evaluating the condition against just the new rows”
↩︎ Alerts that act on event table data“You cannot use EXECUTE ALERT to execute an alert on new data.”
↩︎ Exam trap 2“does not account for latency between the time that the alert is scheduled and the time when the alert condition is actually evaluated.”
↩︎ Prediction - 6.
“An alert on new data triggers when new rows matching a condition are inserted into the event table.”
↩︎ Alerts that act on event table data - 7.
“If there are no recent successful evaluations of the alert condition, the function returns the UNIX epoch timestamp”
↩︎ Alerts that act on event table data - 8.
“The number of trace events per span is capped at 128.”
↩︎ Root cause analysis and tuning with traces“Structured with attributes you can attach to trace events. Attributes are key-value pairs that can be easily queried with a SQL query.”
↩︎ Checkpoint