Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YkBa6-0000r8-NN for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2015 13:17:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YkBa6-0003iY-1t for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2015 13:17:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YkBa4-0003iQ-JY for pgsql-hackers@postgresql.org; Mon, 20 Apr 2015 13:17:44 +0000 Received: from linode.thelabyrinth.net ([2600:3c00::f03c:91ff:fe69:8d76] helo=mail.thelabyrinth.net) by makus.postgresql.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YkBZs-0008KG-VT; Mon, 20 Apr 2015 13:17:42 +0000 Received: from theseus.local (unknown [98.204.177.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id E8C0F12F96; Mon, 20 Apr 2015 13:17:30 +0000 (UTC) Message-ID: <5534FC6E.9030906@pgmasters.net> Date: Mon, 20 Apr 2015 09:17:34 -0400 From: David Steele User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Sawada Masahiko CC: Tatsuo Ishii , Simon Riggs , PostgreSQL-development , Abhijit Menon-Sen , Fujii Masao Subject: Re: Auditing extension for PostgreSQL (Take 2) References: <552326EE.4060509@pgmasters.net> <552D2C1A.3060002@pgmasters.net> <20150415.081354.1167351714960358354.t-ishii@sraoss.co.jp> <552DA959.2010102@pgmasters.net> <552EA121.1090603@pgmasters.net> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Lrk0LHqEnRwfA4WGWphIvAxnVaTFmaUCB" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Lrk0LHqEnRwfA4WGWphIvAxnVaTFmaUCB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/20/15 4:40 AM, Sawada Masahiko wrote: >=20 > Thank you for updating the patch. >=20 > One question about regarding since v7 (or later) patch is; > What is the different between OBJECT logging and SESSION logging? In brief, session logging can log anything that happens in a user session while object logging only targets DML and SELECT on selected relations. The pg_audit.log_relation setting is intended to mimic the prior behavior of pg_audit before object logging was added. In general, I would not expect pg_audit.log =3D 'read, write' to be used with pg_audit.role. In other words, session logging of DML and SELECT should probably not be turned on at the same time as object logging is in use. Object logging is intended to be a fine-grained version of pg_audit.log =3D 'read, write' (one or both). > I used v9 patch with "pg_audit.log_relation =3D on", and got quite > similar but different log as follows. >=20 > =3D# select * from hoge, bar where hoge.col =3D bar.col; > NOTICE: AUDIT: OBJECT,8,1,READ,SELECT,TABLE,public.hoge,"select * > from hoge, bar where hoge.col =3D bar.col;" > NOTICE: AUDIT: SESSION,8,1,READ,SELECT,TABLE,public.hoge,"select * > from hoge, bar where hoge.col =3D bar.col;" > NOTICE: AUDIT: OBJECT,8,1,READ,SELECT,TABLE,public.bar,"select * from > hoge, bar where hoge.col =3D bar.col;" > NOTICE: AUDIT: SESSION,8,1,READ,SELECT,TABLE,public.bar,"select * > from hoge, bar where hoge.col =3D bar.col;" >=20 > The behaviour of SESSION log is similar to OBJECT log now, and SESSION > log per session (i.g, pg_audit.log_relation =3D off) is also similar to= > 'log_statement =3D all'. (enhancing log_statement might be enough) > So I couldn't understand needs of SESSION log. Session logging is quite different from 'log_statement =3D all'. See: http://www.postgresql.org/message-id/552323B2.8060708@pgmasters.net and/or the "Why pg_audit?" section of the pg_audit documentation. I agree that it may make sense in the future to merge session logging into log_statements, but for now it does provide important additional functionality for creating audit logs. Regards, --=20 - David Steele david@pgmasters.net --Lrk0LHqEnRwfA4WGWphIvAxnVaTFmaUCB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVNPxuAAoJEIA2uIJQ5SFAfSsP/2w96rxW7x/HtAG+1vKTk2zs TBPe5Jz7omQ82bHVQxe7NwOoSjWhqR3YxE49+en3bIkR50RK42jq6L3eZsX6PQ4P kVoBEYcGxQjiQloQowtKo86/4ghxo7yBc8cYDwXedHhtyfW6jSoJd00st7PHN7gO 3E7zP3Zxk7gC9zPf5ZFS0oUWj6Kim7HAH6CcD4hE5BFtVDpnLq0/ZsVwalDK2Qo2 SlIOfL7G7ioNoYeWS5xY8Im5Mi1sbkvc+gIycY/aW+WQmYwcAkDSAhsR9qR+EHZC LWcCmMY2EdxnAJaIc4lze9odJBKpU5E5q5LuG1Z+ieuTkBGpgnV9BgnwmMK7Uwcs RqNFsoC5agN8ss+J+NcZfiEb/KuArJhYA0x5RwYgk8I+Kz7JRJ/3wpxrqfxpg6JF Ym1DL3EL4Z/BURBLo6edz4QjVhZrPmsWs+uN90R9NhB6xD8L4cWw9Jsb1uZS37m5 KeAGBwU03/ZAwpfbkOrBfDkF/pNZpjzy6GdBd06ovNFda6cIo5egUuBue5ZTqWZS kje+AH53djYetZUDojH4Pxz11NV32z1dPCLS5/oD4kbxV+SUHsePRcOWPTuz/+4q y9gxV6mBYwgzxzj0O+jVM1QLv9/q715M4JszHfL2+bXf4XyEuEhNI1HI30FojxzP XPqp0zKGRs2h0l1xKxvg =ZNkv -----END PGP SIGNATURE----- --Lrk0LHqEnRwfA4WGWphIvAxnVaTFmaUCB--