DBA Hub

📋Steps in this guide1/1

Enable audit for log on/log off to postgres

- Enable audit for connection and disconnection to postgres.

postgresql configurationintermediate
by PostgreSQL
13 views
1

Enable audit for log on/log off to postgres

- Enable audit for connection and disconnection to postgres.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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=postgres

Comments (0)

Please to add comments

No comments yet. Be the first to comment!