Azure Cosmos DB for PostgreSQL supports pgAudit extension and there’s a guide on learn.microsoft.com. However, the guide doesn’t describe well for worker nodes.
Installing pgAudit
Using the Azure portal:
- Select your Azure Cosmos DB for PostgreSQL cluster.
- On the sidebar, select Coordinator node parameters.
- Search for the
shared_preload_libraries
parameter. - Select pgaudit and save the changes. Your Azure Cosmos DB for PostgreSQL cluster will be restarted.
- After your cluster restarted, on the sidebar, select Worker node parameters.
- Search for the
shared_preload_libraries
parameter. - Select pgaudit and save the changes. Your Azure Cosmos DB for PostgreSQL cluster will be restarted, again.
Using psql:
- Connect to Coordinator node and execute the following query.
BEGIN;
SET LOCAL citus.enable_metadata_sync = false;
SELECT create_extension('pgaudit');
COMMIT;
- Next, execute same commands within all the Worker nodes via run_command_on_workers() UDF.
SELECT run_command_on_workers(
$cmd$
BEGIN;
SET LOCAL citus.enable_metadata_sync = false;
SELECT create_extension('pgaudit');
COMMIT;
$cmd$
);
pgAudit settings
Do similar as learn.microsoft.com for both Coordinator and Workers.