How to Configure Amazon Q CockroachDB Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an amazon q cockroachdb audit log by enabling database logging rules. Then you connect the AI coding agent with a scoped database role. Engineering teams often give AI assistants local database credentials to speed up work. When those roles have broad rights, the agent can run risky commands on live tables. Tracking every query from the assistant becomes vital for security and daily checks. How the native amazon q cockroachdb audit log works Amazon Q runs local terminal commands an

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 an amazon q cockroachdb audit log by enabling database logging rules. Then you connect the AI coding agent with a scoped database role. Engineering teams often give AI assistants local database credentials to speed up work. When those roles have broad rights, the agent can run risky commands on live tables. Tracking every query from the assistant becomes vital for security and daily checks.

How the native amazon q cockroachdb audit log works

Amazon Q runs local terminal commands and database queries on behalf of the developer. It uses the credentials stored in the local shell or project settings. When the agent connects to CockroachDB, the database treats it like any human user. You must turn on table logging inside the database to record these actions. The database engine then writes matching queries to log files on the server nodes.

To make the log useful, teams create a separate database user for the assistant. You assign specific read or write roles to this user. When the agent runs a query, the database records the role name and timestamp. Security teams then ship these log files to a central storage bucket for review. This setup shows which queries came from the AI role versus a human login.

What native logging solves and what it misses

Native database logging helps teams see what happened after a query finishes. It proves which database role ran a statement and when the event took place. This record helps during security reviews and post-incident checks. You can spot failed login attempts or unexpected schema changes in the log files. Pairing a dedicated role with native logs gives you a basic trail of activity.

Still, native setup rules only check who logs in at the start. They do not inspect what individual statements do while they run in flight. If a developer shares their own admin login, the log blends AI and human actions. Also, native audit logs do not stop the agent from pulling raw customer data. Query results can still return clear emails, phone numbers, card numbers, or national IDs.

Audit Log Integrity + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why shared local credentials break audit trails

Developers often let their AI coding tool use their personal terminal environment. The agent picks up existing database keys and session tokens from the local machine. When this happens, every AI query looks like it came from the engineer. The database log cannot tell if a human or a prompt wrote the command. You lose clear visibility into what the automated tool actually did on the cluster.

Fixing this requires more than just a static role inside the database. Teams need a way to link every single query to the exact user identity. They also need controls that rewrite matched fields like card numbers in query results. Stopping bad drop statements before they hit the engine is just as important. Runtime controls fill this gap by checking every command and masking data in flight.

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

Can CockroachDB tell if Amazon Q wrote a SQL query?

No, the database only sees the user role that opens the session. If the agent uses a developer's login, the logs show the developer's name.

Does the native audit log hide sensitive data from the AI agent?

No, native logging only writes down the queries that run on the server. It does not mask emails, phone numbers, or card numbers in the query results.

How should teams limit what Amazon Q can do in the database?

Start by giving the assistant a read-only database role with strict table permissions. Add runtime checks to block risky commands and rewrite sensitive fields in results.

The query runs. The emails stay hidden.