diff --git a/files/gitlab-config-template/gitlab.rb.template b/files/gitlab-config-template/gitlab.rb.template
index 693b758d4eb91b0fc29172a06b86469de68b4477_ZmlsZXMvZ2l0bGFiLWNvbmZpZy10ZW1wbGF0ZS9naXRsYWIucmIudGVtcGxhdGU=..f48e97c5800757d61961d5f54334703d39bb1166_ZmlsZXMvZ2l0bGFiLWNvbmZpZy10ZW1wbGF0ZS9naXRsYWIucmIudGVtcGxhdGU= 100644
--- a/files/gitlab-config-template/gitlab.rb.template
+++ b/files/gitlab-config-template/gitlab.rb.template
@@ -1426,6 +1426,8 @@
 # postgresql['log_truncate_on_rotation'] = nil
 # postgresql['log_rotation_age'] = nil
 # postgresql['log_rotation_size'] = nil
+# postgresql['log_connections'] = "off"
+# postgresql['log_disconnections'] = "off"
 ##! 'username' affects the system and PostgreSQL user accounts created during installation and cannot be changed
 ##! on an existing installation. See https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/3606 for more details.
 # postgresql['username'] = "gitlab-psql"
diff --git a/files/gitlab-cookbooks/postgresql/attributes/default.rb b/files/gitlab-cookbooks/postgresql/attributes/default.rb
index 693b758d4eb91b0fc29172a06b86469de68b4477_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9wb3N0Z3Jlc3FsL2F0dHJpYnV0ZXMvZGVmYXVsdC5yYg==..f48e97c5800757d61961d5f54334703d39bb1166_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9wb3N0Z3Jlc3FsL2F0dHJpYnV0ZXMvZGVmYXVsdC5yYg== 100644
--- a/files/gitlab-cookbooks/postgresql/attributes/default.rb
+++ b/files/gitlab-cookbooks/postgresql/attributes/default.rb
@@ -90,6 +90,8 @@
 default['postgresql']['log_truncate_on_rotation'] = nil
 default['postgresql']['log_rotation_age'] = nil
 default['postgresql']['log_rotation_size'] = nil
+default['postgresql']['log_connections'] = 'off'
+default['postgresql']['log_disconnections'] = 'off'
 
 # Replication settings
 default['postgresql']['sql_replication_user'] = "gitlab_replicator"
diff --git a/files/gitlab-cookbooks/postgresql/templates/default/postgresql-runtime.conf.erb b/files/gitlab-cookbooks/postgresql/templates/default/postgresql-runtime.conf.erb
index 693b758d4eb91b0fc29172a06b86469de68b4477_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9wb3N0Z3Jlc3FsL3RlbXBsYXRlcy9kZWZhdWx0L3Bvc3RncmVzcWwtcnVudGltZS5jb25mLmVyYg==..f48e97c5800757d61961d5f54334703d39bb1166_ZmlsZXMvZ2l0bGFiLWNvb2tib29rcy9wb3N0Z3Jlc3FsL3RlbXBsYXRlcy9kZWZhdWx0L3Bvc3RncmVzcWwtcnVudGltZS5jb25mLmVyYg== 100644
--- a/files/gitlab-cookbooks/postgresql/templates/default/postgresql-runtime.conf.erb
+++ b/files/gitlab-cookbooks/postgresql/templates/default/postgresql-runtime.conf.erb
@@ -80,6 +80,14 @@
 log_checkpoints = <%= @log_checkpoints %>
 <% end %>
 
+<% if @log_connections %>
+log_connections = <%= @log_connections %>
+<% end %>
+
+<% if @log_disconnections %>
+log_disconnections = <%= @log_disconnections %>
+<% end %>
+
 log_line_prefix = '<%= @log_line_prefix %>' # default '', special values:
           #   %a = application name
           #   %u = user name
diff --git a/spec/chef/cookbooks/postgresql/recipes/postgresql_spec.rb b/spec/chef/cookbooks/postgresql/recipes/postgresql_spec.rb
index 693b758d4eb91b0fc29172a06b86469de68b4477_c3BlYy9jaGVmL2Nvb2tib29rcy9wb3N0Z3Jlc3FsL3JlY2lwZXMvcG9zdGdyZXNxbF9zcGVjLnJi..f48e97c5800757d61961d5f54334703d39bb1166_c3BlYy9jaGVmL2Nvb2tib29rcy9wb3N0Z3Jlc3FsL3JlY2lwZXMvcG9zdGdyZXNxbF9zcGVjLnJi 100644
--- a/spec/chef/cookbooks/postgresql/recipes/postgresql_spec.rb
+++ b/spec/chef/cookbooks/postgresql/recipes/postgresql_spec.rb
@@ -304,6 +304,24 @@
           runtime_conf
         ).with_content(/synchronous_commit = on/)
       end
+
+      it 'sets log_connections setting' do
+        expect(chef_run.node['postgresql']['log_connections'])
+          .to eq('off')
+
+        expect(chef_run).to render_file(
+          runtime_conf
+        ).with_content(/log_connections = off/)
+      end
+
+      it 'sets log_disconnections setting' do
+        expect(chef_run.node['postgresql']['log_disconnections'])
+          .to eq('off')
+
+        expect(chef_run).to render_file(
+          runtime_conf
+        ).with_content(/log_disconnections = off/)
+      end
     end
 
     context 'when rendering pg_hba.conf' do
@@ -425,6 +443,8 @@
                          max_standby_streaming_delay: '120s',
                          archive_command: 'command',
                          archive_timeout: '120',
+                         log_connections: 'on',
+                         log_disconnections: 'on'
                        })
       end
 
@@ -461,6 +481,24 @@
           runtime_conf
         ).with_content(/archive_timeout = 120/)
       end
+
+      it 'sets log_connections setting' do
+        expect(chef_run.node['postgresql']['log_connections'])
+          .to eq('on')
+
+        expect(chef_run).to render_file(
+          runtime_conf
+        ).with_content(/log_connections = on/)
+      end
+
+      it 'sets log_disconnections setting' do
+        expect(chef_run.node['postgresql']['log_disconnections'])
+          .to eq('on')
+
+        expect(chef_run).to render_file(
+          runtime_conf
+        ).with_content(/log_disconnections = on/)
+      end
     end
 
     context 'when rendering pg_hba.conf' do