Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YtD0O-0001HO-9w for pgsql-committers@arkaria.postgresql.org; Fri, 15 May 2015 10:38:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YtD0M-0007rr-UZ for pgsql-committers@arkaria.postgresql.org; Fri, 15 May 2015 10:38:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YtD0M-0007rk-7O for pgsql-committers@postgresql.org; Fri, 15 May 2015 10:38:10 +0000 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YtD0J-00063r-3L for pgsql-committers@postgresql.org; Fri, 15 May 2015 10:38:09 +0000 Received: by labbd9 with SMTP id bd9so113093511lab.2 for ; Fri, 15 May 2015 03:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=8NKPO6Df1H5b7SYJhuPi2LiJ4CdOGswHnGAlvmxIx/A=; b=LLWzyOcF1xWHTRqTlR3P3cAD5UOP7w+yO9a4Q8slZ8bHQthUZtokeFCMLLY4lf3nyo D2fRdwUeJx48d9vzWSsL6MIDfRopQDT2KO8jd5bDDYe+J4hWHsznr9/1FRwJGBft5VXv mK8cbgwMjd2uspIjXPl0ozOKNx4lG2QujL8vmdXFqiVze5xK7lKrjnX1zKizHv2uCGdz 8iVXOJ74s1/NvjEoOt7EFnxNDLoIXL5pID1xfkt94OImtOkGlhTssGGDUTSA8WGnebJb cxGPIFF5MGTkKhRJ4nF8P9Rdr2DtgwDnd/H/eooteJgK6WY0FrC2d9pq8Zm1RqocgH39 qFgw== X-Received: by 10.152.116.102 with SMTP id jv6mr6657601lab.50.1431686285172; Fri, 15 May 2015 03:38:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.214.9 with HTTP; Fri, 15 May 2015 03:37:34 -0700 (PDT) In-Reply-To: References: <20267.1431615541@sss.pgh.pa.us> <20150514150047.GX30322@tamriel.snowman.net> <20458.1431615970@sss.pgh.pa.us> <20150514154619.GY30322@tamriel.snowman.net> <21368.1431618712@sss.pgh.pa.us> <20150514161032.GA30322@tamriel.snowman.net> <4844.1431621244@sss.pgh.pa.us> <20150514163551.GB30322@tamriel.snowman.net> <5043.1431621669@sss.pgh.pa.us> <20150514192135.GK30322@tamriel.snowman.net> <20150514193028.GL30322@tamriel.snowman.net> From: Thom Brown Date: Fri, 15 May 2015 11:37:34 +0100 X-Google-Sender-Auth: cVLeuYlwbYQiIZ8dhhn-9Eh2Cgs Message-ID: Subject: Re: pgsql: Add pg_audit, an auditing extension To: Pavel Stehule Cc: Stephen Frost , Tom Lane , "pgsql-committers@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 15 May 2015 at 11:20, Pavel Stehule wrote: > > > 2015-05-15 12:14 GMT+02:00 Thom Brown : >> >> On 15 May 2015 at 10:56, Pavel Stehule wrote: >> > Hi >> > >> > I am testing it, and output is strange >> > >> > 2015-05-15 11:49:25.046 CEST pavel postgres: LOG: AUDIT: >> > SESSION,1,1,DDL,DROP TABLE,,,drop table foo;, >> > 2015-05-15 11:49:25.046 CEST pavel postgres: STATEMENT: drop table foo; >> > 2015-05-15 11:49:28.291 CEST pavel postgres: LOG: AUDIT: >> > SESSION,2,1,DDL,CREATE TABLE,,,"CREATE TABLE foo(a int, b int);",> > logged> >> > 2015-05-15 11:49:28.291 CEST pavel postgres: STATEMENT: CREATE TABLE >> > foo(a >> > int, b int); >> > 2015-05-15 11:49:31.486 CEST pavel postgres: LOG: AUDIT: >> > SESSION,3,1,WRITE,INSERT,,,"INSERT INTO foo VALUES(10,20);", >> > 2015-05-15 11:49:31.486 CEST pavel postgres: STATEMENT: INSERT INTO foo >> > VALUES(10,20); >> > 2015-05-15 11:49:33.446 CEST pavel postgres: LOG: AUDIT: >> > SESSION,4,1,READ,SELECT,,,SELECT * FROM foo WHERE a = 10;, >> > 2015-05-15 11:49:33.446 CEST pavel postgres: STATEMENT: SELECT * FROM >> > foo >> > WHERE a = 10; >> > >> > I am missing object name, unexpected string >> > >> > configuration: >> > pg_audit.log = 'read, write, ddl' >> >> From what I can tell, that last value should be for parameters. You'd >> need to set pg_audit.log_parameter to on, and then prepare and execute >> a statement with a parameter. > > > yes > > 2015-05-15 12:18:39.545 CEST pavel postgres: LOG: AUDIT: > SESSION,1,1,READ,PREPARE,,,prepare x(int) as select * from foo where a = > $1;, > 2015-05-15 12:18:39.545 CEST pavel postgres: STATEMENT: prepare x(int) as > select * from foo where a = $1; > 2015-05-15 12:18:48.065 CEST pavel postgres: LOG: AUDIT: > SESSION,2,1,READ,SELECT,,,prepare x(int) as select * from foo where a = > $1;,10 > 2015-05-15 12:18:48.065 CEST pavel postgres: STATEMENT: execute x(10); > > but when pg_audit.log_parameter is off, then this value should be empty If it were empty, it would then be indistinguishable from a statement executed with a single parameter passed as an empty string. Speaking of which, I notice that nulls show up as nothing too. How does one distinguish between an empty string and a null in the logs? -- Thom -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers