Performance Monitoring and Tuning · Topic 9 of 16

Event Tables - Logging, Metrics and Tracing Setup

Enable logging and tracing with Snowflake event tables: default versus custom tables, setup, and the LOG_LEVEL, METRIC_LEVEL and TRACE_LEVEL settings.

  • 4 min
  • Includes a diagram
In a nutshell
  • Event tables store logs, metrics and traces in a predefined column layout.
  • SNOWFLAKE.TELEMETRY.EVENTS is the default and active unless you set another; read it through EVENTS_VIEW.
  • ALTER ACCOUNT SET EVENT_TABLE or ALTER DATABASE ... SET EVENT_TABLE associates a custom table; the database setting wins for its objects.

What it is

An event table is a special table with a fixed set of columns that stores telemetry emitted by Snowflake and by your own code: logs (messages), metrics and traces (spans). Stored procedures, user defined functions and other supported objects write to it when their levels allow.

The administrator decides which event table is active, who may read it, and how much telemetry to collect, since more telemetry means more storage and cost.

Procedure or UDFyour codeemitsTelemetrylogs, metrics, spanscollected if level allowsActive event tableaccount or databasequeried byAnalystsSQL, Snowsight

How it works

Default system event table versus custom tables

The default event table SNOWFLAKE.TELEMETRY.EVENTS is active with no setup and is read through EVENTS_VIEW with the EVENTS_VIEWER and EVENTS_ADMIN roles; a custom event table is created and set with EVENT_TABLE at account or database level, and access follows privileges on the table.

AspectDefault SNOWFLAKE.TELEMETRY.EVENTSCustom event table
CreationExists in the SNOWFLAKE databaseYou run CREATE EVENT TABLE
Active by defaultYes, if you set no other event tableNo; you set it with EVENT_TABLE
ColumnsPredefinedPredefined; you do not define them
AccessSNOWFLAKE.TELEMETRY.EVENTS_VIEW, with EVENTS_VIEWER and EVENTS_ADMIN application rolesNormal privileges on the table you own
Row access policyAttach to the view (Enterprise Edition)Possible on your own table design
ScopeAccountAccount or a single database
DDLSupports only a subset of commandsFull table style control by its owner

Pick the default when you want telemetry with no setup and controlled access through the view. Pick a custom table when you need per database separation, your own retention handling, or tighter ownership.

Event tables in primary databases are not replicated.

Configure event tables

Creating and associating a custom table takes three steps.

CREATE EVENT TABLE my_db.logs.app_events;
ALTER ACCOUNT SET EVENT_TABLE = my_db.logs.app_events;
-- or for one database (Enterprise Edition):
ALTER DATABASE sales SET EVENT_TABLE = my_db.logs.sales_events;
SHOW PARAMETERS LIKE 'event_table' IN ACCOUNT;
  • You need the CREATE EVENT TABLE privilege to create it.
  • Account association needs ACCOUNTADMIN (or the account level privilege) plus OWNERSHIP or INSERT on the table.
  • A database level event table takes precedence over the account table for objects in that database.
  • ALTER ACCOUNT UNSET EVENT_TABLE removes the association.

To read the default table safely, grant EVENTS_VIEWER to roles instead of users.

Set levels for logs, metrics and tracing

Three parameters decide what is captured. They can be set on the account, a database, a schema, or a specific function or procedure, and the most specific setting wins. If a level is also set for the session, the more verbose of the session and object values applies.

ParameterValuesDefault
LOG_LEVELTRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFFOFF
METRIC_LEVELALL, NONENONE
TRACE_LEVELALWAYS, ON_EVENT, OFFOFF

A level lets through messages at that severity and worse. LOG_LEVEL = WARN keeps WARN, ERROR and FATAL and drops the rest. TRACE_LEVEL = ALWAYS records spans for every execution, while ON_EVENT records them only when the code adds a trace event.

ALTER ACCOUNT SET LOG_LEVEL = WARN;
ALTER DATABASE sales SET LOG_LEVEL = INFO;
ALTER FUNCTION my_udf(INT) SET LOG_LEVEL = DEBUG, TRACE_LEVEL = ALWAYS;
Watch out

With the defaults of OFF and NONE, no telemetry is captured even when an event table is active. Both an active table and a permissive level are needed.

Manage logging and tracing over time

  • Telemetry collection and storage have costs, so raise levels for investigation and lower them afterward.
  • Control who can read the table, because logs may contain sensitive values.
  • Clean up with DELETE or TRUNCATE where you own the table; for the default table, EVENTS_ADMIN carries those rights.
Choose tabledefault or customsetEVENT_TABLEaccount or databasesetLevelsLOG, METRIC, TRACEgrantRead accessroles

Common mistakes

Setting an event table but leaving levels at default. Nothing is collected until levels allow it.

Granting the default table to users directly. Grant the application roles to roles, and use the view for access control.

Setting LOG_LEVEL = DEBUG account wide and forgetting it. It floods storage and raises cost.

Defining your own columns. Event table columns are fixed.

What to remember for the exam

  • Event tables store logs, metrics and traces in a predefined column layout.
  • SNOWFLAKE.TELEMETRY.EVENTS is the default and active unless you set another; read it through EVENTS_VIEW.
  • ALTER ACCOUNT SET EVENT_TABLE or ALTER DATABASE ... SET EVENT_TABLE associates a custom table; the database setting wins for its objects.
  • Defaults: LOG_LEVEL OFF, METRIC_LEVEL NONE, TRACE_LEVEL OFF.
  • More telemetry means more cost; keep levels as low as the use case allows.

Check yourself

  • Which parameter and value turn on trace capture for every execution?

    TRACE_LEVEL = ALWAYS.

  • An event table is active but no logs appear. Why might that be?

    LOG_LEVEL is still at its default of OFF for those objects.

  • When would you choose a custom event table over the default?

    For per database separation, your own retention handling or tighter ownership.

Topic 9 of 16 in Performance Monitoring and Tuning

Test yourself on Performance Monitoring and Tuning

The full Snowflake ADA-C02 question bank has 814 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.