(pgaudit) Audit log is not output after the SET ROLE.

From: Toshi Harada <harada(dot)toshi(at)po(dot)ntts(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: (pgaudit) Audit log is not output after the SET ROLE.
Date: 2016-03-07 09:39:20
Message-ID: 201603070940.u279e0iL029017@ccmds33.silk.ntts.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

I am testing the pgaudit(https://commitfest.postgresql.org/9/463/).
(use "http://www.postgresql.org/message-id/56B0101B.6070704@pgmasters.net" attached patch on 9.6-devel)

I found strange thing.

- After SET ROLE, part of the SQL is not the audit log output.
- SQL comprising a relation is not output to the audit log.

* Reproduce:
** prepare

createuser test_user -U postgres
createdb test -U postgres -O test_user
psql test -U test_user -c "CREATE TABLE team(id int, name text)"

** pgaudit settings

shared_preload_libraries = 'pgaudit'
pgaudit.log = 'all'

** test sql script (test.sql)

SELECT 1;
SELECT * FROM team; -- output audit log
SET ROLE test_user;
SELECT 2;
SELECT * FROM team; -- no output audit log
SELECT 3;
RESET ROLE;
SELECT * FROM team; -- output audit log

** run script

psql test -U postgres -f test.sql

** audit log

LOG: AUDIT: SESSION,1,1,READ,SELECT,,,SELECT 1;,<not logged>
LOG: AUDIT: SESSION,2,1,READ,SELECT,,,SELECT * FROM team;,<not logged>
LOG: AUDIT: SESSION,3,1,MISC,SET,,,SET ROLE test_user;,<not logged>
LOG: AUDIT: SESSION,4,1,READ,SELECT,,,SELECT 2;,<not logged>
LOG: AUDIT: SESSION,5,1,READ,SELECT,,,SELECT 3;,<not logged>
LOG: AUDIT: SESSION,6,1,MISC,RESET,,,RESET ROLE;,<not logged>
LOG: AUDIT: SESSION,7,1,READ,SELECT,,,SELECT * FROM team;,<not logged>

Regards,
Harada Toshi.
NTT Softeare Corporation

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-03-07 09:58:59 Re: extend pgbench expressions with functions
Previous Message Kouhei Kaigai 2016-03-07 09:32:53 Re: Way to check whether a particular block is on the shared_buffer?