Install PgAudit
docker exec -it postgres sh -c 'apt-get update && apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-pgaudit'
$PGDATA/postgresql.conf
shared_preload_libraries = 'pgaudit'
pgaudit.log = 'all, -misc' # ddl...
pgaudit.log_catalog = off
pgaudit.log_level = off
pgaudit.log_parameter = on
pgaudit.log_relation = on
logging_collector = on
log_directory = 'log'
# log_line_prefix = '?'
docker-compose restart postgres && docker exec -it postgres psql -U postgres
CREATE EXTENSION pgaudit;
SELECT EXISTS(SELECT 1 FROM pg_extension where extname = 'pgaudit'); -- t
SHOW logging_collector; -- on
create table test
(
test text
);
insert into test (test)
values ('test');
tail -f $PGDATA/log/postgresql-*.log