Time-Series Database

TimescaleDB Connector

Comprehensive audit logging for TimescaleDB time-series databases. Monitor queries on hypertables, continuous aggregates, and leverage full PostgreSQL audit capabilities for your time-series workloads.

Native Deep Integration

DB Audit leverages pgAudit and TimescaleDB's information schema for comprehensive audit coverage including hypertable operations, chunk management, and continuous aggregate queries.

pgAudit Extension Hypertable Auditing pg_stat_statements

Time-Series Auditing

Track queries across hypertables, chunks, and time-partitioned data with full temporal context.

Continuous Aggregate Monitoring

Monitor access to materialized views and continuous aggregates for analytics workloads.

PostgreSQL Compatible

Full pgAudit support leveraging TimescaleDB's PostgreSQL foundation.

Prerequisites

Supported Versions

  • TimescaleDB 2.0 and later
  • Timescale Cloud (all tiers)
  • PostgreSQL 12+ with TimescaleDB extension
  • Self-managed TimescaleDB installations

Network Requirements

  • Port 5432 (PostgreSQL default)
  • SSL/TLS encryption (recommended)
  • VPC peering for Timescale Cloud

Configuration Reference

1 Basic Connection

Field Type Required Default Description
name string Yes - A unique, descriptive name for this connection (e.g., "timescaledb-metrics-prod")
db_type select Yes timescaledb Database type - select "TimescaleDB"
host string Yes - TimescaleDB server hostname (e.g., "timescale.example.com" or Timescale Cloud hostname)
port number Yes 5432 TimescaleDB port (default: 5432, same as PostgreSQL)
database_name string Yes - Target database name (e.g., "metrics", "iot_data")
username string Yes - TimescaleDB user with audit privileges (e.g., "dbaudit_reader")
password password Yes - Password for the TimescaleDB user

2 SSL/TLS Configuration

Field Type Required Default Description
ssl_mode select No prefer SSL connection mode: disable, allow, prefer, require, verify-ca, verify-full
ssl_ca_cert textarea No - CA certificate for verifying the TimescaleDB server certificate
ssl_client_cert textarea No - Client certificate for certificate-based authentication
ssl_client_key password No - Client private key for certificate-based authentication

3 Cloud Configuration

Field Type Required Description
cloud_provider select No Cloud provider: timescale_cloud, aws, azure, gcp
cloud_region string No Cloud region (e.g., "us-east-1", "eu-west-1")
project_id string No Timescale Cloud project ID
service_id string No Timescale Cloud service ID

4 Log Collection Configuration

Field Type Required Default Description
log_collection_type select Yes native_audit Log collection method: native_audit (pgaudit), cloudwatch, custom_query
use_pgaudit boolean No true Enable pgAudit extension for comprehensive audit logging
use_pg_stat_statements boolean No true Enable pg_stat_statements for query statistics
poll_interval number No 30 How often to poll for new audit events (in seconds)
include_hypertables boolean No true Include TimescaleDB-specific hypertable operations in audit logs

Log Collection Methods

pgAudit Extension

Recommended

PostgreSQL Audit Extension for comprehensive session and object-level logging

Advantages:

  • Full PostgreSQL compatibility
  • Fine-grained object auditing
  • Session and statement logging
  • Low overhead
Setup: Install pgaudit extension and configure in postgresql.conf

pg_stat_statements

Built-in PostgreSQL extension for query performance and statistics tracking

Advantages:

  • No external dependencies
  • Query performance metrics
  • Top query identification
Setup: Enable via shared_preload_libraries

CloudWatch Logs

AWS CloudWatch integration for TimescaleDB on AWS

Advantages:

  • AWS ecosystem integration
  • Centralized logging
  • Built-in retention
Setup: Configure enhanced monitoring for RDS/EC2 deployments

Setup Instructions

1

Create Audit User

Create a dedicated TimescaleDB user for DB Audit with read access to data and TimescaleDB information schema.

                -- Create a dedicated audit user
CREATE USER dbaudit_reader WITH PASSWORD 'secure_password';

-- Grant connect privilege
GRANT CONNECT ON DATABASE metrics TO dbaudit_reader;

-- Grant schema access
GRANT USAGE ON SCHEMA public TO dbaudit_reader;
GRANT USAGE ON SCHEMA timescaledb_information TO dbaudit_reader;
GRANT USAGE ON SCHEMA _timescaledb_internal TO dbaudit_reader;

-- Grant read access to tables and views
GRANT SELECT ON ALL TABLES IN SCHEMA public TO dbaudit_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA timescaledb_information TO dbaudit_reader;

-- Grant access to pg_stat_statements
GRANT pg_read_all_stats TO dbaudit_reader;
              
2

Install pgAudit Extension

Enable the pgAudit extension for comprehensive audit logging.

                -- Install pgAudit extension
CREATE EXTENSION IF NOT EXISTS pgaudit;

-- Configure pgAudit in postgresql.conf or via ALTER SYSTEM
ALTER SYSTEM SET pgaudit.log = 'all';
ALTER SYSTEM SET pgaudit.log_catalog = 'on';
ALTER SYSTEM SET pgaudit.log_client = 'on';
ALTER SYSTEM SET pgaudit.log_level = 'log';
ALTER SYSTEM SET pgaudit.log_parameter = 'on';
ALTER SYSTEM SET pgaudit.log_statement_once = 'off';

-- Reload configuration
SELECT pg_reload_conf();
              

Note: On Timescale Cloud, pgAudit may need to be enabled via the dashboard or by contacting support.

3

Enable pg_stat_statements (Optional)

Enable query statistics tracking for performance insights.

                -- Install pg_stat_statements
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

-- Configure in postgresql.conf
-- shared_preload_libraries = 'pg_stat_statements,timescaledb'
-- pg_stat_statements.track = all
-- pg_stat_statements.max = 10000

-- Query statement statistics
SELECT
    calls,
    total_exec_time,
    mean_exec_time,
    rows,
    query
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 20;
              
4

Verify TimescaleDB Access

Confirm the audit user can access TimescaleDB information schema views.

                -- View hypertables
SELECT * FROM timescaledb_information.hypertables;

-- View continuous aggregates
SELECT * FROM timescaledb_information.continuous_aggregates;

-- View compression settings
SELECT * FROM timescaledb_information.compression_settings;

-- View job statistics (background workers)
SELECT * FROM timescaledb_information.job_stats;

-- Query chunk information
SELECT
    hypertable_name,
    chunk_name,
    range_start,
    range_end,
    is_compressed
FROM timescaledb_information.chunks
ORDER BY range_start DESC;
              
5

Test Connection

Verify connectivity and permissions using psql.

                # Test connection using psql
psql -h localhost -p 5432 -U dbaudit_reader -d metrics

# Verify TimescaleDB extension
\dx timescaledb

# Check pgAudit configuration
SHOW pgaudit.log;

# Verify user permissions
SELECT * FROM timescaledb_information.hypertables LIMIT 1;
              
6

Configure in DB Audit

Add the TimescaleDB connection in the DB Audit dashboard.

  1. Navigate to Connections in DB Audit
  2. Click Add Connection
  3. Select TimescaleDB as the database type
  4. Enter your connection details and credentials
  5. Enable hypertable auditing options
  6. Test the connection and save

Data Collected

Time-Series Queries

Hypertable SELECT, INSERT operations with time ranges

Aggregate Access

Continuous aggregate queries and refreshes

Schema Changes

Hypertable creation, chunk operations, compression

User Sessions

Login/logout events, session tracking

Privilege Changes

GRANT, REVOKE, role modifications

Chunk Operations

Chunk creation, compression, and retention policy

Background Jobs

Automated job executions and status

Query Performance

Execution times, rows affected, planning stats

Troubleshooting

pgAudit extension not available

Ensure pgAudit is installed and loaded in shared_preload_libraries.

            # Check if pgAudit is available
SELECT * FROM pg_available_extensions WHERE name = 'pgaudit';
          

Cannot access TimescaleDB information schema

Grant USAGE on the timescaledb_information schema to the audit user.

            GRANT USAGE ON SCHEMA timescaledb_information TO dbaudit_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA timescaledb_information TO dbaudit_reader;
          

Connection timeout on Timescale Cloud

Ensure your IP is allowed in the Timescale Cloud service's allowed IP list or configure VPC peering.

Missing hypertable information

Verify the TimescaleDB extension is installed and the database contains hypertables.

            SELECT extversion FROM pg_extension WHERE extname = 'timescaledb';
SELECT count(*) FROM timescaledb_information.hypertables;
          

Compliance Support

SOC 2

Access logging and change tracking

HIPAA

PHI access auditing

PCI DSS

Cardholder data monitoring

GDPR

Personal data access trails

Ready to Audit Your TimescaleDB Databases?

Start monitoring your time-series databases in minutes with comprehensive audit logging.