The open-source pgAudit extension in AlloyDB for PostgreSQL lets you selectively
record and track SQL operations performed against your databases. Detailed
session and object audit logs help you monitor database activity and meet
government, financial, and ISO compliance requirements.

## Overview

Database auditing in AlloyDB is available through the
pgAudit extension, which monitors and records a configurable subset of
executed SQL commands and queries. In contrast,
[Cloud Audit Logs](https://docs.cloud.google.com/logging/docs/audit.md.txt) records administrative and maintenance
operations performed on an AlloyDB instance, as described in
[Monitor access using audit logs](https://docs.cloud.google.com/alloydb/docs/audit-logging.md.txt).

> [!IMPORTANT]
> **Important:** AlloyDB uses an asynchronous managed pipeline to process user-generated audit logs. Records are temporarily buffered on the instance's local storage before being securely forwarded to Cloud Logging. This local buffering provides high-performance logging, but it consumes temporary disk space on the instance. For more information about local storage limits, see [Limitations](https://docs.cloud.google.com/alloydb/docs/pgaudit/about.md.txt#limitations).

## Limitations

The following limitations apply to the pgAudit functionality:

- Creation and processing of audit log records is asynchronous. You might
  experience a small delay before audit records are available in
  Cloud Logging. You can monitor the current size of the pending audit data,
  which can indicate the extent of the delay, using the
  `alloydb.googleapis.com/node/database/logging/audit/backlog_bytes_count`
  metric in Cloud Monitoring. For more information, see
  [Monitor audit log pipeline status](https://docs.cloud.google.com/alloydb/docs/pgaudit/view-audit-log.md.txt#monitor-audit-log-pipeline-status).

- When pgAudit is enabled and configured, the creation rate of audit log
  records depends on your configuration and workload activity.

- The system is designed to support a maximum log ingestion rate of 90 MiB per
  second.

- When log generation rate exceeds the platform's ingestion capacity, logs are
  buffered locally. Sustained backpressure can result in the following:

  - Higher latency between audit events and records visible in Cloud Logging.

  - Instance restarts or crashes resulting from local disk space exhaustion.

  - Intermittent gaps in processed and persisted audit log trails.

- The maximum size for a single audit record is 1 MB.