Skip to main content

Cotool + Snowflake

Connect Snowflake to Cotool for read-only SQL over security tables, and to ingest Snowflake's own login, query, and access history for detections.

SIEM & Data Lake
Updated

The short answer

Cotool's Snowflake integration does two jobs. Agents discover and query the security data you keep in Snowflake with read-only SQL, and Cotool collects Snowflake's own login, query, and access history so you can detect misuse of the warehouse itself.[1]

How it connects: Cotool signs in as a dedicated Snowflake service user, preferably with key-pair authentication, and runs statements on a warehouse you choose. Snowflake has no read-only session mode, so the role's grants are what keep Cotool read-only.[1][6]

What Cotool uses from Snowflake

Databases, schemas, and tables
Agents browse databases, schemas, tables, and views, search tables by name, and inspect a table's columns, clustering key, size, comments, and sample rows. Listing and describing use SHOW and DESCRIBE, which don't resume the warehouse.[1]
Read-only SQL
Cotool accepts only SELECT, WITH, SHOW, DESCRIBE, and EXPLAIN, one statement per call. Results return 500 rows by default and at most 10,000, with truncated: true when more rows matched.[1]
LOGIN_HISTORY
Login attempts by Snowflake users over the last 365 days, with up to 120 minutes of latency before rows appear.[1][4]
ACCESS_HISTORY and QUERY_HISTORY
Access history records which objects and columns each query read or wrote, over the last 365 days, with up to 180 minutes of latency. It requires Enterprise Edition or higher. Query history holds each query's full text.[1][5]

Detections, hunts, and triage

Hunt in logs you already land in SnowflakeHunt
Teams that keep Okta, CloudTrail, or EDR logs in Snowflake tables let agents query them in place. Comments on tables and columns help agents pick the right source during discovery.[1][2]
Detect warehouse misuseDetection
With login, query, and access history ingested, Python detections can flag sign-ins from unexpected networks, failed-login bursts on service users, or a user reading tables they have never touched.[1][3][5]
Investigate a data access alertTriage
An agent joins ACCESS_HISTORY with QUERY_HISTORY to show exactly which objects a user's queries touched and the statements they ran, then attaches both to its verdict.[1][5]

Example query

Failed sign-ins by user and client IPsql
SELECT user_name, client_ip, reported_client_type,
       COUNT(*) AS failures,
       MIN(event_timestamp) AS first_seen,
       MAX(event_timestamp) AS last_seen
FROM snowflake.account_usage.login_history
WHERE is_success = 'NO'
  AND event_timestamp > DATEADD(hour, -24, CURRENT_TIMESTAMP())
GROUP BY 1, 2, 3
ORDER BY failures DESC
LIMIT 100;

A read-only query over LOGIN_HISTORY. Remember the view's latency: the most recent two hours may be incomplete, so a detection that runs on it should look back past that window.[1][4]

Setup and permissions

Generate an RSA key pair, create a TYPE = SERVICE user with the public key, and paste the private key into Cotool. Snowflake requires at least a 2048-bit RSA key for key-pair authentication.[1][6]

PermissionAccess
USAGE on a dedicated warehouseLets the role run queries on the warehouse, which consumes credits. Cotool recommends a dedicated X-Small warehouse with auto-suspend.[1][8]Read
USAGE and SELECT on your security databaseLets agents read your security tables and views. Skip this grant for ingest-only access.[1][8]Read
SNOWFLAKE.SECURITY_VIEWERDatabase role for LOGIN_HISTORY and SESSIONS in ACCOUNT_USAGE.[1][7]Read
SNOWFLAKE.GOVERNANCE_VIEWERDatabase role for QUERY_HISTORY and ACCESS_HISTORY in ACCOUNT_USAGE.[1][7]Read
  • Prefer the SNOWFLAKE database roles over granting imported privileges on the SNOWFLAKE database, which exposes every view in it.[1][7]
  • Don't grant ownership, INSERT, UPDATE, DELETE, or ALL PRIVILEGES. Cotool only reads.[1]

How Cotool works with Snowflake

  • Cotool polls each Snowflake log stream every 15 minutes and stays behind real time by that stream's publication delay, with an hourly pass that re-reads older windows for late rows.[1]
  • Each statement has a timeout, 300 seconds by default and at most 30 minutes, enforced by both Snowflake and Cotool. Cotool's statements carry the query tag cotool-agent so you can audit and cost them.[1]
  • After you connect, and weekly after that, Cotool maps up to 300 tables and views the role can see, with their columns, clustering keys, row counts, and a few sample rows.[1]

FAQ

Can I use Snowflake only for log ingest?
Yes. Give the role only warehouse usage and the SNOWFLAKE database roles for your streams. Agents then can't read your own databases, though they can still query the ACCOUNT_USAGE views those roles cover.[1]
How fresh is Snowflake login data?
Snowflake says LOGIN_HISTORY latency may be up to 120 minutes, and ACCESS_HISTORY up to 180 minutes. Detections on these views run at least that far behind real time.[4][5]

Sources

  1. Snowflake Integration (Cotool docs) · accessed November 16, 2026
  2. Log storage optimized for agents (Cotool Observe) · accessed November 16, 2026
  3. Detections are code (Cotool Detect) · accessed November 16, 2026
  4. LOGIN_HISTORY view (Snowflake docs) · accessed November 16, 2026
  5. ACCESS_HISTORY view (Snowflake docs) · accessed November 16, 2026
  6. Key-pair authentication and key-pair rotation (Snowflake docs) · accessed November 16, 2026
  7. SNOWFLAKE database roles (Snowflake docs) · accessed November 16, 2026
  8. Access control privileges (Snowflake docs) · accessed November 16, 2026

Related integrations

All integrations

Use cases with Snowflake

Related reading

Attackers are scaling with tokens

Cotool helps defenders operate at machine speed. See how security teams are scaling Detection & Response.

Book a demo