How to Configure Goose CockroachDB Audit Log
To set up a goose cockroachdb audit log workflow, enable table auditing and run migrations. You give your migration tool a database role and turn on native logging rules. Most teams share one admin role across developers, build jobs, and AI coding agents. Broad roles let tools alter tables or read raw rows without clear user tracking. When an automated script or agent makes a mistake, the team struggles to trace it. How the goose cockroachdb audit log setup works Goose is a schema tool that r
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.
To set up a goose cockroachdb audit log workflow, enable table auditing and run migrations. You give your migration tool a database role and turn on native logging rules. Most teams share one admin role across developers, build jobs, and AI coding agents. Broad roles let tools alter tables or read raw rows without clear user tracking. When an automated script or agent makes a mistake, the team struggles to trace it.
How the goose cockroachdb audit log setup works
Goose is a schema tool that runs SQL files or Go code in order. It tracks applied changes inside a state table in your target CockroachDB cluster. To set this up, admins create a dedicated role for the schema tool. That role needs rights to create tables, change columns, and update the state table.
Next, the database team turns on the native audit log feature in CockroachDB. Admins mark sensitive tables and system catalogs so the cluster records every query event. When Goose runs a migration, the database engine writes an entry to disk. These log files capture the timestamp, the SQL text, and the active database role. Teams then ship these log files to a central store for security checks.
Where native database logging falls short
Native audit logs are great for recording events after they happen on the cluster. They show which database role ran a statement and when the query finished. Still, native logs only know the database user, not the real person or agent. If five engineers share one migration role, the log shows the same role name.
This gap grows worse when teams use AI tools or local scripts for migrations. Native setup rules decide who can log in to the cluster at the start. They do not inspect or stop single risky commands while the session is live. A tool with schema rights can drop a table or read customer emails and card numbers. Native logs will record the bad query, but they cannot block it in flight. They also cannot rewrite sensitive fields like phone numbers or national IDs in query results.
Audit Log Integrity + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Best practices for safer schema changes
Start by splitting database roles so humans and automated jobs never share login keys. Give your build pipeline a role that only runs during planned release windows. Remove broad read rights from migration roles so they only touch table structures. Keep your state table locked down so regular app roles cannot change migration history.
When engineers or AI helpers test migrations, check every statement before it hits production. Review logs often to spot odd query patterns or unexpected table reads right away. Combine native cluster logs with controls that tie every query to a verified user identity. Masking rules can also rewrite matched fields like emails and card numbers in query outputs.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
What does Goose store inside CockroachDB?
Goose keeps a small state table inside your database to track version numbers. Each row shows a migration file ID, a timestamp, and whether it ran.
Does the CockroachDB audit log slow down schema migrations?
Turning on audit logging adds a small disk write step for each tracked statement. Since schema migrations run far fewer queries than live apps, the impact stays tiny.
How can teams trace which developer ran a manual Goose migration?
Native logs only show the shared database role unless each user has a separate login. Tying database sessions to single sign-on identities lets teams see the exact person responsible.
Related guides
In this post