3.1.18 Ensure 'log_connections' is enabled

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

Enabling the log_connections setting causes each attempted connection to the server to be logged, as well as successful completion of client authentication. This parameter cannot be changed after session start.

Rationale:

PostgreSQL does not maintain an internal record of attempted connections to the database for later auditing. It is only by enabling the logging of these attempts that one can determine if unexpected attempts are being made.

Note that enabling this without also enabling log_disconnections 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_connections = 'on';
ALTER SYSTEM
postgres=# select pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)

Default Value:

off

References:

https://www.postgresql.org/docs/12/static/runtime-config-logging.html

See Also

https://workbench.cisecurity.org/files/2536