Stay organized with collections
Save and categorize content based on your preferences.
To enable auditing on an AlloyDB instance, you perform two steps. First, you
enable alloydb.enable_pgaudit flag on the instance. Then, you connect to the
cluster's primary instance and create the pgaudit extension in the databases.
Enable pgAudit on the instance:
Console
In the Google Cloud console, go to the Clusters
page.
In the Overview page, go to Instances in your cluster,
select an instance, and then click Edit.
Add the alloydb.enable_pgaudit flag on your instance:
Click Add flag.
Select the alloydb.enable_pgaudit flag from the
New database flag list.
Select on from the Value list.
Click Done.
Click Update instance.
gcloud
Enable pgAudit on an instance by setting that instance's alloydb.enable_pgaudit flag to on. For more information on setting an instance's database flags using the Google Cloud CLI, see Configure an instance's database flags.
Note that AlloyDB automatically restarts the instance after
you update this flag.
Connect to the primary instance and create the extension in each database.
You must perform the following steps on the primary instance even if you are
enabling auditing on a read pool instance:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eAuditing on an AlloyDB instance requires enabling the \u003ccode\u003ealloydb.enable_pgaudit\u003c/code\u003e flag.\u003c/p\u003e\n"],["\u003cp\u003eAfter enabling the flag, connect to the cluster's primary instance to create the \u003ccode\u003epgaudit\u003c/code\u003e extension in each desired database.\u003c/p\u003e\n"],["\u003cp\u003eSetting \u003ccode\u003ealloydb.enable_pgaudit\u003c/code\u003e to true and \u003ccode\u003elogging_collector\u003c/code\u003e to on may cause a loss of audit logs in AlloyDB Omni.\u003c/p\u003e\n"],["\u003cp\u003eOnly users in the \u003ccode\u003ealloydbsuperuser\u003c/code\u003e role can create extensions, and the postgres user is part of it by default.\u003c/p\u003e\n"],["\u003cp\u003eEnabling the \u003ccode\u003epgAudit\u003c/code\u003e extension may lead to increased data storage requirements in the event of a service disruption.\u003c/p\u003e\n"]]],[],null,[]]