Logging and monitoring

PostgreSQL instance with ‘log_disconnections’ flag disabled

Description

PostgreSQL does not log session details such as duration and session end by default. Enabling the log_disconnections setting will create log entries at the end of each session which can be useful in troubleshooting issues and determine any unusual activity across a time period. The log_disconnections and log_connections work hand in hand and generally, the pair would be enabled/disabled together.
  • Recommended Mitigation

    Add the following database flag: 'log_disconnections=on'.