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.
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
SHOWandDESCRIBE, which don't resume the warehouse.[1] - Read-only SQL
- Cotool accepts only
SELECT,WITH,SHOW,DESCRIBE, andEXPLAIN, one statement per call. Results return 500 rows by default and at most 10,000, withtruncated: truewhen more rows matched.[1]
Detections, hunts, and triage
Example query
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]
| Permission | Access | Why |
|---|---|---|
| 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 | Lets the role run queries on the warehouse, which consumes credits. Cotool recommends a dedicated X-Small warehouse with auto-suspend.[1][8] |
| USAGE and SELECT on your security databaseLets agents read your security tables and views. Skip this grant for ingest-only access.[1][8] | Read | Lets agents read your security tables and views. Skip this grant for ingest-only access.[1][8] |
SNOWFLAKE.SECURITY_VIEWERDatabase role for LOGIN_HISTORY and SESSIONS in ACCOUNT_USAGE.[1][7] | Read | Database role for LOGIN_HISTORY and SESSIONS in ACCOUNT_USAGE.[1][7] |
SNOWFLAKE.GOVERNANCE_VIEWERDatabase role for QUERY_HISTORY and ACCESS_HISTORY in ACCOUNT_USAGE.[1][7] | Read | Database role for QUERY_HISTORY and ACCESS_HISTORY in ACCOUNT_USAGE.[1][7] |
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-agentso 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]
Sources
- Snowflake Integration (Cotool docs) · accessed November 16, 2026
- Log storage optimized for agents (Cotool Observe) · accessed November 16, 2026
- Detections are code (Cotool Detect) · accessed November 16, 2026
- LOGIN_HISTORY view (Snowflake docs) · accessed November 16, 2026
- ACCESS_HISTORY view (Snowflake docs) · accessed November 16, 2026
- Key-pair authentication and key-pair rotation (Snowflake docs) · accessed November 16, 2026
- SNOWFLAKE database roles (Snowflake docs) · accessed November 16, 2026
- Access control privileges (Snowflake docs) · accessed November 16, 2026

