Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpnwi-0002uH-N3 for pgsql-general@arkaria.postgresql.org; Thu, 17 Dec 2020 07:43:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpnwg-0000Ie-JL for pgsql-general@arkaria.postgresql.org; Thu, 17 Dec 2020 07:43:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpnwg-0000IV-Bb for pgsql-general@lists.postgresql.org; Thu, 17 Dec 2020 07:43:30 +0000 Received: from smtpout1.smhi.se ([2001:67c:274:5501::30]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpnwd-0001fK-RX for pgsql-general@lists.postgresql.org; Thu, 17 Dec 2020 07:43:29 +0000 Received: from winserv743.ad.smhi.se (winserv743.ad.smhi.se [172.16.6.38]) by smtpout1.smhi.se (Postfix) with ESMTPS id 3187B1095099; Thu, 17 Dec 2020 07:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smhi.se; s=20180112; t=1608191007; bh=LpzsvGAjIhsPVAzJnF0Bnh0TgXQ7ojwKC9KAo7dt9bY=; h=From:To:Subject:Date:References:In-Reply-To:From; b=DlyOq3pjJD+SaKHnpgjfkwU0FY7hyCATbvx4rueEIGMq+6GtVE9QuXL0qHpKhJ4KM PEQHBBXSAEnFD4POD/1Ogte08g0w8+htlhp9PtJFql7Kz3e2bvn6KeVGyuujlb2DJK tlHCzI+7S+RkuCILlbXZmRLqzhBj/t5vstEZO0E4= Received: from winserv744.ad.smhi.se (172.16.6.35) by winserv743.ad.smhi.se (172.16.6.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 17 Dec 2020 08:43:27 +0100 Received: from winserv744.ad.smhi.se ([fe80::c19c:d0f0:5830:a72b]) by winserv744.ad.smhi.se ([fe80::c19c:d0f0:5830:a72b%9]) with mapi id 15.01.2106.006; Thu, 17 Dec 2020 08:43:26 +0100 From: Gustavsson Mikael To: Ayub M , PostgreSQL General Subject: SV: postgres auditing truncates and deletes on tables Thread-Topic: postgres auditing truncates and deletes on tables Thread-Index: AQHW0wW1P9Ova1JNvkWnyM79WY343Kn66iFm Date: Thu, 17 Dec 2020 07:43:26 +0000 Message-ID: References: In-Reply-To: Accept-Language: sv-SE, en-US Content-Language: sv-SE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.122.0.145] Content-Type: multipart/alternative; boundary="_000_d0c51c935a86409ba6dad26d4679e1fdsmhise_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_d0c51c935a86409ba6dad26d4679e1fdsmhise_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I have used this setup to do something similar. https://github.com/2ndQuadrant/audit-trigger KR, Mikael Gustavsson ________________________________ Fr=E5n: Ayub M Skickat: den 15 december 2020 18:13:39 Till: PostgreSQL General =C4mne: postgres auditing truncates and deletes on tables for an RDS Aurora PostgreSQL v11.7 database I want to setup DDL and truncat= e and delete auditing. I am setting log_statement to DDL, to log all DDLs (this excludes truncate = statements). I also want to setup auditing only for deletes and truncates o= n tables. I don't want to set log_statement to all, as this would fill up m= y logs. Checking in pg_audit, it supports write class which includes delete and tru= ncate, but it also includes write/update and copy which I don't need. Is there any way to setup auditing to audit DDL plus deletes/truncates only= using pg_audit/native auditing? --_000_d0c51c935a86409ba6dad26d4679e1fdsmhise_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi,


I have used this setup to do something similar.


https://github.com/2ndQua= drant/audit-trigger


KR, Mikael Gustavsson


Fr=E5n: Ayub M <hiayub@g= mail.com>
Skickat: den 15 december 2020 18:13:39
Till: PostgreSQL General
=C4mne: postgres auditing truncates and deletes on tables
 

for an RDS Aurora PostgreSQL v11.7 database I want to setup DDL and truncat= e and delete auditing.

I am setting log_statement to DDL, to log all DDLs (this excludes truncate = statements). I also want to setup auditing only for deletes and truncates o= n tables. I don't want to set log_statement to all, as this would fill up m= y logs.

Checking in pg_audit, it supports write class which includes delete and tru= ncate, but it also includes write/update and copy which I don't need.

Is there any way to setup auditing to audit DDL plus deletes/truncates only= using pg_audit/native auditing?

--_000_d0c51c935a86409ba6dad26d4679e1fdsmhise_--