3.1.21 Ensure 'log_disconnections' is enabled

Information

Enabling the log_disconnections setting logs the end of each session, including session duration. This parameter cannot be changed after the session start.

Rationale:

PostgreSQL does not maintain the beginning or ending of a connection internally for later review. It is only by enabling the logging of these that one can examine connections for failed attempts, 'over long' duration, or other anomalies.

Note that enabling this without also enabling log_connections provides little value. Generally, you would enable/disable the pair together.

Solution

Execute the following SQL statement(s) to enable this setting:

postgres=# alter system set log_disconnections = 'on';

ALTER SYSTEM

postgres=# select pg_reload_conf();

pg_reload_conf

----------------

t

(1 row)

Then, in a new connection to the database, verify the change:

postgres=# show log_disconnections;

log_disconnections

--------------------

on

(1 row)

Note that you cannot verify this change in the same connection in which it was changed; a new connection is needed.

Default Value:

off

See Also

https://workbench.cisecurity.org/benchmarks/24765

Item Details

Category: AUDIT AND ACCOUNTABILITY

References: 800-53|AU-3, 800-53|AU-3(1), 800-53|AU-7, 800-53|AU-12, CSCv7|6.3

Plugin: PostgreSQLDB

Control ID: caa153d7bfb27d3c60d4828a310bfb91997d485891676793656a6a4296f78a4a