Enable audit for log on/log off to postgres
- Enable audit for connection and disconnection to postgres.
postgresql configurationintermediate
by PostgreSQL
13 views
- Enable audit for connection and disconnection to postgres.
12345678910111213141516171819202122
postgres=#
select name,setting from pg_settings where name in ('log_disconnections','log_connections');
name | setting
--------------------+---------
log_connections | off
log_disconnections | off
postgres=#
alter system set log_disconnections=off;
ALTER SYSTEM
postgres=#
alter system set log_connections=on;
ALTER SYSTEM
postgres=#
select pg_reload_conf();
pg_reload_conf
----------------
t
Now all log on and log off will logged in the log file.
<<<<<<<<< cd /Library/PostgreSQL/10/data/log/ >>>>>>>
2020-07-06 12:51:39.042 IST [10212] LOG: connection received: host=[local]
2020-07-06 12:51:53.416 IST [10215] LOG: connection received: host=[local]
2020-07-06 12:51:53.420 IST [10215] LOG: connection authorized: user=postgres database=postgresPlease to add comments
No comments yet. Be the first to comment!