How to Configure Snowflake Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a snowflake audit log by granting read permissions on built-in usage views. These system views record every login attempt, role change, and SQL query in your account. Most data teams start by giving admin roles broad read permissions across these tracking schemas. Broad permissions make setup fast, but they expose sensitive query text to too many users. When everyone shares one high-level role, you lose clear tracking of who ran which query. How the native snowflake audit log works

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up a snowflake audit log by granting read permissions on built-in usage views. These system views record every login attempt, role change, and SQL query in your account. Most data teams start by giving admin roles broad read permissions across these tracking schemas. Broad permissions make setup fast, but they expose sensitive query text to too many users. When everyone shares one high-level role, you lose clear tracking of who ran which query.

How the native snowflake audit log works

Snowflake records account activity in a shared system database that holds historical metadata views. The platform writes login events, role grants, and query history into these read-only tables. Admins do not need to turn on a special switch to start recording events. The system captures this activity by default as users log in and run statements. To read the snowflake audit log, an admin grants view permissions to a custom role. Security teams then use that role to query login history and review past SQL statements. You can also copy these system views into standard tables for long-term storage. Moving the data into your own tables helps you keep records past the default limit. Teams often send these copied records to an external security tool for central alerting. You schedule a recurring task to read new rows and export them to cloud storage. From cloud storage, your security platform ingests the files and checks for odd behavior.

What native logging solves and where gaps remain

Native system views give you a reliable history of what happened inside the data warehouse. You can see which role ran a query, how long it took, and what changed. This historical record helps teams pass audits and find slow queries that waste compute credits. Still, native logs only tell you what happened after a statement finishes running. There is also a time delay before new events show up in the history views. If an engineer runs a bad update, the log records the mistake after the fact. Native logging also struggles when apps or analysts share a single service account. The log shows the shared role name, not the real person behind the keyboard. Also, native logs do not stop raw data from leaving the database in results. If a query pulls emails, phone numbers, or card numbers, the user gets everything. Dynamic masking rewrites matched fields in results, yet requires rules on every single column.

Best practices for managing audit history

Start by creating a dedicated role just for reading security and usage history views. Never grant full account admin rights to users or apps that only read logs. Separate your log readers from the engineers who manage tables and run daily jobs. Next, set up a daily job that copies new history rows into a secure database. Lock down that archive database so regular users cannot alter or delete past records. Check your login history views every day for failed password attempts or strange network locations. Review role grant logs to catch privilege creep before temporary permissions become permanent risks. Finally, pair your historical logs with runtime controls that check queries before they execute. Looking at old logs is useful, but stopping bad queries in flight protects production data.

Audit Log Integrity + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

How long does Snowflake keep native audit history?

The built-in account usage views keep historical query and login records for one full year. If you need longer retention, copy those rows into your own permanent storage tables.

Why are my latest queries missing from the audit view?

System usage views have a built-in processing delay that ranges from minutes to hours. Because of this lag, recent queries will not show up in your audit reports right away.

Can standard users edit or delete the native audit log?

No user can edit or delete rows inside the read-only system usage views. Still, if you copy logs into custom tables, you must lock down write permissions yourself.

The query runs. The emails stay hidden.