Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQbKd-0000eO-3K for pgsql-admin@arkaria.postgresql.org; Mon, 09 Jan 2017 14:53:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cQbKb-00058S-ML for pgsql-admin@arkaria.postgresql.org; Mon, 09 Jan 2017 14:53:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cQbCw-0001pN-0M for pgsql-admin@postgresql.org; Mon, 09 Jan 2017 14:45:58 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cQbCn-0001qM-MB for pgsql-admin@postgresql.org; Mon, 09 Jan 2017 14:45:56 +0000 Received: from Davids-MacBook.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 34811556D0; Mon, 9 Jan 2017 14:45:48 +0000 (UTC) Subject: Re: Fwd: Can I bother you for some more assistance? To: John Scalia , "pgsql-admin@postgresql.org" References: From: David Steele Message-ID: Date: Mon, 9 Jan 2017 09:45:45 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Hi John, On 1/6/17 10:55 AM, John Scalia wrote: > -- Null out pgaudit.log or the extension will not load > SET pgaudit.log = ''; > CREATE EXTENSION pgaudit; > SET pgaudit.log = 'function,ddl,rule,misc'; > \i .usr/pgaudit_analyze/sql/audit.sql > > --- I have to exit the database at this point or the create schema > database command will fail, not sure why. Maybe the audit.sql is doing > something weird. What error are you seeing? Create database must run in its own transaction so it will error if you try to run all these commands in a single transaction. > psql -U postgres phi > CREATE SCHEMA phi; > SET search_path TO phi, pgaudit, public; > GRANT ALL ON SCHEMA phi TO postgres; > CREATE TABLE patient (id INT, 'first_name' VARCHAR(20), 'last_name' > VARCHAR(30), SS_NUM CHAR(12), mpi VARCHAR(20)); > SET pgaudit.role = 'auditor'; > GRANT select, update, delete on patient TO auditor; > > -- The INSERT command should not logged > INSERT INTO patient VALUES (1, 'Test', 'Test', '000-00-0000', 'T29383'); > > -- The UPDATE should be logged > UPDATE patient SET mpi = 'T459093'; You have not granted the auditor role usage on the phi schema and this is likely why insert and update are not being logged. > If you'll note the last 4 commands, they're basically identical to the > pgaudit instructions, but the CSV logfile shows '' for > both of these as opposed to showing that the UPDATE command should > have been logged. refers to the parameters, not the statement. log_parameter is off by default. Regards, -- -David david@thelabyrinth.net -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin