Skip to content

Enable audit logs via pgaudit #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 23, 2021
Merged

Enable audit logs via pgaudit #296

merged 2 commits into from
Nov 23, 2021

Conversation

eberlep
Copy link
Collaborator

@eberlep eberlep commented Nov 22, 2021

No description provided.

@eberlep eberlep linked an issue Nov 22, 2021 that may be closed by this pull request
@eberlep
Copy link
Collaborator Author

eberlep commented Nov 23, 2021

Tested:

root@pgft-test3c9519abe2928402-0:/home/postgres/pgdata/pgroot/pg_log# grep -i audit *.csv | tail

postgresql-2.csv:2021-11-23 09:15:12.989 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,60,"CREATE EXTENSION",2021-11-23 09:15:12 UTC,5/208,0,LOG,00000,"AUDIT: SESSION,20,1,DDL,CREATE EXTENSION,,,CREATE EXTENSION IF NOT EXISTS pg_stat_kcache SCHEMA public;,<none>",,,,,,,,,"psql"
postgresql-2.csv:2021-11-23 09:15:12.989 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,62,"CREATE EXTENSION",2021-11-23 09:15:12 UTC,5/209,0,LOG,00000,"AUDIT: SESSION,21,1,DDL,CREATE EXTENSION,,,CREATE EXTENSION IF NOT EXISTS set_user SCHEMA public;,<none>",,,,,,,,,"psql"
postgresql-2.csv:2021-11-23 09:15:12.990 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,64,"ALTER EXTENSION",2021-11-23 09:15:12 UTC,5/210,0,LOG,00000,"AUDIT: SESSION,22,1,DDL,ALTER EXTENSION,,,ALTER EXTENSION set_user UPDATE;,<none>",,,,,,,,,"psql"
postgresql-2.csv:2021-11-23 09:15:12.993 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,69,"CREATE SCHEMA",2021-11-23 09:15:12 UTC,5/214,0,LOG,00000,"AUDIT: SESSION,23,1,DDL,CREATE SCHEMA,,,CREATE SCHEMA IF NOT EXISTS metric_helpers AUTHORIZATION postgres;,<none>",,,,,,,,,"psql"
postgresql-2.csv:2021-11-23 09:15:13.007 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,73,"CREATE FUNCTION",2021-11-23 09:15:12 UTC,5/218,40861,LOG,00000,"AUDIT: SESSION,24,1,DDL,CREATE FUNCTION,,,""CREATE OR REPLACE FUNCTION get_table_bloat_approx (
postgresql-2.csv:2021-11-23 09:15:13.086 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,78,"CREATE VIEW",2021-11-23 09:15:12 UTC,5/222,40865,LOG,00000,"AUDIT: SESSION,25,1,DDL,CREATE VIEW,,,CREATE OR REPLACE VIEW table_bloat AS SELECT * FROM get_table_bloat_approx();,<none>",,,,,,,,,"psql"
postgresql-2.csv:2021-11-23 09:15:13.099 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,83,"CREATE FUNCTION",2021-11-23 09:15:12 UTC,5/226,40869,LOG,00000,"AUDIT: SESSION,26,1,DDL,CREATE FUNCTION,,,""CREATE OR REPLACE FUNCTION get_btree_bloat_approx (
postgresql-2.csv:2021-11-23 09:15:13.105 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,88,"CREATE VIEW",2021-11-23 09:15:12 UTC,5/230,40873,LOG,00000,"AUDIT: SESSION,27,1,DDL,CREATE VIEW,,,CREATE OR REPLACE VIEW index_bloat AS SELECT * FROM get_btree_bloat_approx();,<none>",,,,,,,,,"psql"
postgresql-2.csv:2021-11-23 09:15:13.109 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,93,"CREATE FUNCTION",2021-11-23 09:15:12 UTC,5/234,40877,LOG,00000,"AUDIT: SESSION,28,1,DDL,CREATE FUNCTION,,,""CREATE OR REPLACE FUNCTION pg_stat_statements(showtext boolean) RETURNS SETOF public.pg_stat_statements AS
postgresql-2.csv:2021-11-23 09:15:13.192 UTC,"postgres","ftdb01",571,"[local]",619cb120.23b,98,"CREATE VIEW",2021-11-23 09:15:12 UTC,5/238,40881,LOG,00000,"AUDIT: SESSION,29,1,DDL,CREATE VIEW,,,CREATE OR REPLACE VIEW pg_stat_statements AS SELECT * FROM pg_stat_statements(true);,<none>",,,,,,,,,"psql"

@eberlep eberlep merged commit aecb894 into main Nov 23, 2021
@eberlep eberlep deleted the 273-pgaudit-logs branch August 19, 2022 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable Audit Logs (via pgaudit)
2 participants