How to enable audit log on worker nodes

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:

  1. Select your Azure Cosmos DB for PostgreSQL cluster.
  2. On the sidebar, select Coordinator node parameters.
  3. Search for the shared_preload_libraries parameter.
  4. Select pgaudit and save the changes. Your Azure Cosmos DB for PostgreSQL cluster will be restarted.
  5. After your cluster restarted, on the sidebar, select Worker node parameters.
  6. Search for the shared_preload_libraries parameter.
  7. Select pgaudit and save the changes. Your Azure Cosmos DB for PostgreSQL cluster will be restarted, again.

Using psql:

  1. Connect to Coordinator node and execute the following query.
BEGIN; 
  SET LOCAL citus.enable_metadata_sync = false; 
  SELECT create_extension('pgaudit'); 
COMMIT;
  1. 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.

タイトルとURLをコピーしました