How to Configure TimescaleDB Audit Log
You set up a timescaledb audit log by turning on native PostgreSQL statement logging and extension rules. This setup writes database events, role changes, and time-series queries to disk for review. Most teams start by turning on full statement logs for their main database roles. Still, broad role permissions and heavy time-series writes make those log files grow fast. How the native timescaledb audit log works TimescaleDB runs as an extension inside a standard PostgreSQL database engine. Bec
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 a timescaledb audit log by turning on native PostgreSQL statement logging and extension rules. This setup writes database events, role changes, and time-series queries to disk for review. Most teams start by turning on full statement logs for their main database roles. Still, broad role permissions and heavy time-series writes make those log files grow fast.
How the native timescaledb audit log works
TimescaleDB runs as an extension inside a standard PostgreSQL database engine. Because of this design, it uses the native PostgreSQL logging system to record activity. You can pair basic server logs with standard audit extensions to track specific tables. The database engine checks every incoming query against your active logging rules. When a query matches a rule, the engine writes a record to the local disk.
Time-series workloads behave in a different way than normal relational apps. Sensor apps and metrics tools send thousands of small write queries every second. If you log every write event, the disk fills up in a few hours. To avoid this problem, admins often scope rules down to human roles and schema changes. You set up one rule for DDL changes and another for manual read queries. The database then skips high-volume background writes from automated apps.
Teams also need to manage how the server stores and rotates these files. Local log files sit on the same storage volume as your time-series data chunks. Admins ship these files to an external log store right away. Moving logs off the main server keeps disk space free for new time-series data. It also stops users with server roles from changing past log files.
What native logging solves and what it misses
Native database logs give you a clear record of what ran inside the engine. You can see which database role ran a drop command or changed a hypertable. This record helps your security team review past incidents and pass basic audits. It works well when every person and app uses a unique database role.
Still, native logging has big blind spots during live operations. First, shared roles break your audit trail right away. Many teams still let several developers log in with the same admin role. When someone runs a bad query, the log only shows the shared role name. You cannot tell which actual person on your team ran that command.
Audit Log Integrity + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Second, database logs only record events after the query runs. They decide what gets written to disk, not what queries should be blocked in flight. If an engineer runs a wide read query, the log records the command text. It does not rewrite sensitive fields like emails, phone numbers, or card numbers in results. The raw data still reaches the client tool before anyone reads the log.
Managing log volume and sensitive data in flight
High query volume is the hardest part of running a time-series audit trail. Even human analysts run complex queries that scan millions of rows across many chunks. Logging the full text and bind values of every query creates huge files. These massive files cost a lot to store and take hours to search. Plus, storing bind values in plain text puts private user data into your log files. Emails and national IDs end up sitting in plain text inside your log store.
To fix this, teams separate identity tracking and data masking from the database engine. Instead of logging everything on the database disk, you inspect queries before they run. This approach ties every query to a real user identity from your login provider. You can also apply masking rules that rewrite emails and card numbers in query results. The database stays fast because it only handles time-series reads and writes.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Does TimescaleDB have its own separate audit tool?
No, TimescaleDB relies on the underlying PostgreSQL logging engine and standard audit extensions. You set up rules at the PostgreSQL level to track activity across hypertables and chunks.
How do I stop time-series writes from filling up the audit disk?
You should exclude automated ingestion roles from statement-level logging rules. Focus your audit rules on human user roles, schema changes, and permission updates instead.
Can native database logs hide sensitive data in query results?
No, native database logs only write a record of the query to a file. They cannot inspect result sets in flight or rewrite fields like emails and phone numbers.
Related guides
In this post