How to Configure Goose Neon Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a goose neon audit log, enable Postgres logging in your Neon project. Then point your Goose migration tool to a dedicated database role for clear tracking. Teams often start by running database changes with a shared admin account. When everyone shares one role, your logs cannot show which person ran a bad change. Broad permissions also let a single mistake drop a live table. How a goose neon audit log works in practice Goose is a tool that helps teams manage database schema changes

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 neon audit log, enable Postgres logging in your Neon project. Then point your Goose migration tool to a dedicated database role for clear tracking. Teams often start by running database changes with a shared admin account. When everyone shares one role, your logs cannot show which person ran a bad change. Broad permissions also let a single mistake drop a live table.

How a goose neon audit log works in practice

Goose is a tool that helps teams manage database schema changes over time. It reads SQL or Go files and applies them to your database in order. Neon is a cloud Postgres service that separates compute from storage. When Goose runs a change against Neon, the database records a state update.

To build a goose neon audit log, you link two main parts. First, Goose tracks its own history inside a special table in your database. This table records the version number and the time each file ran. Second, Neon captures system events and SQL queries through standard Postgres logging extensions.

You should give Goose its own Postgres role with limited write rights. When the tool logs in, Neon tags every action with that role name. Your log export then shows the exact statements that altered your tables. Teams send these records to a central log store for review and alerts.

What native logging solves and where gaps remain

A native setup tells you when a schema change happened and which role ran it. It helps your team verify that staging and production databases match. You can also see failed migration steps right away in your log stream. This visibility is great for basic review and fixing broken builds.

Still, native database roles only check who logs in at the start. They do not inspect what individual statements do while they run in flight. A migration role needs rights to alter tables, which means it can also delete data. Native logs record the damage after it happens, rather than stopping risky commands first.

Shared service keys also hide the real person behind a manual migration run. If an engineer uses the migration key from a laptop, the log shows the bot role. Also, if a developer queries tables during a fix, raw emails or card numbers return unchanged. Standard database roles cannot rewrite matched fields in results or require approval for one command.

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 database migrations

Start by removing admin rights from daily developer accounts. Only allow automated build pipelines to run standard schema changes in production. Keep your migration role separate from the role your main app uses to read data. This split makes your audit trail much easier to read during an incident.

Review your migration files before they reach your live database branches. Neon lets you create quick database branches to test changes safely. Run Goose against a fresh branch first and check the resulting log output. Once the test passes, you can apply the same change to your main branch.

Even with good tests, engineers sometimes need direct access to fix a broken state. For those moments, static roles and after-the-fact logs are not enough. Teams need a way to tie every query to a real human identity. They also need controls that inspect commands before the database runs them.

Run guardrails and masking on the Postgres connection

Role grants and firewall rules are needed setup. Setup alone cannot check single SQL statements or mask sensitive rows in a response. By design, hoop.dev is an open-source proxy that sits beside Postgres, RDS, or Aurora as a sidecar for your Postgres. Clients and agent tools keep their credentials and point their connection string at the listener.

On each query, hoop.dev guardrails refuse disallowed drops, deletes, or table reads before they run. Next, hoop.dev data masking rewrites sensitive fields in returned rows that match your rules. Furthermore, hoop.dev holds SOC 2 Type II and logs every statement and verdict per resource. Check out the project on GitHub.

Frequently asked questions

Does Goose keep its own log of database changes?

Yes, Goose creates a version table inside your target database. This table tracks which migration files have run and when they finished. Still, it does not log the full SQL text or failed query attempts.

How do I see who ran a Goose command in Neon?

Neon logs the Postgres role name used for the database session. If your team shares one database user, all actions look the same. You must use separate roles or an identity tool to see individual names.

Can native Neon logs block a bad migration from dropping a table?

No, audit logs only record events after the database processes them. If the database role has permission to drop a table, the command will run. You need pre-execution controls or stricter role grants to prevent destructive actions.

The query runs. The emails stay hidden.