To disable pgAudit on an AlloyDB for PostgreSQL instance, set the value of the
`alloydb.enable_pgaudit` flag to `off`. You can change the
value of the `alloydb.enable_pgaudit` flag through the Google Cloud console
or the Google Cloud CLI.

To disable the `alloydb.enable_pgaudit` flag, use the standard
instructions as described in
[Configure an instance's database flags](https://docs.cloud.google.com/alloydb/docs/instance-configure-database-flags.md.txt).

When you disable the `alloydb.enable_pgaudit` flag, audit logging stops
after the instance restarts. However, AlloyDB saves the applied
pgAudit settings, such as the `pgaudit.log` parameter settings.

> [!NOTE]
> **Note:** The instance automatically restarts when you update the `alloydb.enable_pgaudit` flag. You don't need to modify the `shared_preload_libraries` database flag when disabling pgAudit, because `shared_preload_libraries` is a system-managed flag in AlloyDB and can't be modified directly.

Additionally, run the `DROP EXTENSION` command by using a compatible
`psql` client to remove the extension state:

1. Connect a `psql` client to the cluster's primary instance, as described in [Connect a psql client to
   an instance](https://docs.cloud.google.com/alloydb/docs/connect-psql).
2. At the `psql` command prompt, connect to the database that has the extension enabled and drop the extension:

   ```
       \c DB_NAME
       DROP EXTENSION pgaudit;
       
   ```

   Replace `DB_NAME` with the name of the database.
3. Repeat the previous two steps to connect to other databases and drop the extension in each one of them.