↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Configuration Parameters

log_connections

Causes aspects of each connection to the server to be logged. The default is the empty string, '', which disables all connection logging. The following options may be specified alone or in a comma-separated list: Table 19.4. Log Connection OptionsNameDescriptionreceiptLogs receipt of a connection.authentication Logs the original identity used by an authentication method to identify a user. In most cases, the identity string matches the PostgreSQL username, but some third-party authentication methods may alter the original user identifier before the server stores it. Failed authentication is always logged regardless of the value of this setting. authorization Logs successful completion of authorization. At this point the connection has been established but the backend is not yet fully set up. The log message includes the authorized username as well as the database name and application name, if applicable. setup_durations Logs the time spent establishing the connection and setting up the backend until the connection is ready to execute its first query. The log message includes three durations: the total setup duration (starting from the postmaster accepting the incoming connection and ending when the connection is ready for query), the time it took to fork the new backend, and the time it took to authenticate the user. all A convenience alias equivalent to specifying all options. If all is specified in a list of other options, all connection aspects will be logged. Disconnection logging is separately controlled by log_disconnections. For the purposes of backwards compatibility, on, off, true, false, yes, no, 1, and 0 are still supported. The positive values are equivalent to specifying the receipt, authentication, and authorization options. Only superusers and users with the appropriate SET privilege can change this parameter at session start, and it cannot be changed at all within a session. Note Some client programs, like psql, attempt to connect twice while determining if a password is required, so duplicate “connection received” messages do not necessarily indicate a problem.

English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

boot val
Unknown
category
Reporting and Logging / What to Log
context
superuser-backend
doc same as
Unknown
documented
true
enumvals
Unknown
extra desc
Unknown
lang
en
max val
Unknown
metadata version
18
min val
Unknown
name
log_connections
short desc
Logs specified aspects of connection establishment and setup.
source
pg-settings-source-snapshot
unit
Unknown
vartype
string

Definition PG 18

Causes aspects of each connection to the server to be logged. The default is the empty string, '', which disables all connection logging. The following options may be specified alone or in a comma-separated list:

Table 19.4. Log Connection Options

NameDescription
receiptLogs receipt of a connection.
authentication Logs the original identity used by an authentication method to identify a user. In most cases, the identity string matches the PostgreSQL username, but some third-party authentication methods may alter the original user identifier before the server stores it. Failed authentication is always logged regardless of the value of this setting.
authorization Logs successful completion of authorization. At this point the connection has been established but the backend is not yet fully set up. The log message includes the authorized username as well as the database name and application name, if applicable.
setup_durations Logs the time spent establishing the connection and setting up the backend until the connection is ready to execute its first query. The log message includes three durations: the total setup duration (starting from the postmaster accepting the incoming connection and ending when the connection is ready for query), the time it took to fork the new backend, and the time it took to authenticate the user.
all A convenience alias equivalent to specifying all options. If all is specified in a list of other options, all connection aspects will be logged.

Disconnection logging is separately controlled by log_disconnections.

For the purposes of backwards compatibility, on, off, true, false, yes, no, 1, and 0 are still supported. The positive values are equivalent to specifying the receipt, authentication, and authorization options.

Only superusers and users with the appropriate SET privilege can change this parameter at session start, and it cannot be changed at all within a session.

Note

Some client programs, like psql, attempt to connect twice while determining if a password is required, so duplicate “connection received” messages do not necessarily indicate a problem.

Compare versions

Complete source facts

doc html

<p>
        Causes aspects of each connection to the server to be logged.
        The default is the empty string, <code class="literal">''</code>, which
        disables all connection logging. The following options may be
        specified alone or in a comma-separated list:
       </p><div class="table" id="LOG-CONNECTIONS-OPTIONS"><p class="title"><strong>Table 19.4. Log Connection Options</strong></p><div class="table-contents"><table border="1" class="table" summary="Log Connection Options"><colgroup><col class="col1"/><col class="col2"/></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">receipt</code></td><td>Logs receipt of a connection.</td></tr><tr><td><code class="literal">authentication</code></td><td>
            Logs the original identity used by an authentication method
            to identify a user. In most cases, the identity string
            matches the <span class="productname">PostgreSQL</span> username,
            but some third-party authentication methods may alter the
            original user identifier before the server stores it. Failed
            authentication is always logged regardless of the value of
            this setting.
           </td></tr><tr><td><code class="literal">authorization</code></td><td>
            Logs successful completion of authorization. At this point
            the connection has been established but the backend is not
            yet fully set up. The log message includes the authorized
            username as well as the database name and application name,
            if applicable.
           </td></tr><tr><td><code class="literal">setup_durations</code></td><td>
            Logs the time spent establishing the connection and setting up the
            backend until the connection is ready to execute its first
            query. The log message includes three durations:  the total
            setup duration (starting from the postmaster accepting the
            incoming connection and ending when the connection is ready
            for query), the time it took to fork the new backend, and
            the time it took to authenticate the user.
           </td></tr><tr><td><code class="literal">all</code></td><td>
            A convenience alias equivalent to specifying all options. If
            <code class="literal">all</code> is specified in a list of other
            options, all connection aspects will be logged.
           </td></tr></tbody></table></div></div><br class="table-break"/><p>
        Disconnection logging is separately controlled by <a class="xref" href="/docs/18/runtime-config-logging.html#GUC-LOG-DISCONNECTIONS">log_disconnections</a>.
       </p><p>
        For the purposes of backwards compatibility, <code class="literal">on</code>,
        <code class="literal">off</code>, <code class="literal">true</code>,
        <code class="literal">false</code>, <code class="literal">yes</code>,
        <code class="literal">no</code>, <code class="literal">1</code>, and <code class="literal">0</code>
        are still supported. The positive values are equivalent to specifying
        the <code class="literal">receipt</code>, <code class="literal">authentication</code>, and
        <code class="literal">authorization</code> options.
       </p><p>
        Only superusers and users with the appropriate <code class="literal">SET</code>
        privilege can change this parameter at session start,
        and it cannot be changed at all within a session.
       </p><div class="note"><h3 class="title">Note</h3><p>
         Some client programs, like <span class="application">psql</span>, attempt
         to connect twice while determining if a password is required, so
         duplicate <span class="quote">“<span class="quote">connection received</span>”</span> messages do not
         necessarily indicate a problem.
        </p></div>

documentation revision

{"inputs":[{"file":"runtime-config-logging.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","version":"18.7"},{"file":"runtime-config-logging.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"68c010254e1859ec0b76f06a563babd51a6c38997f1242e35e4c6b649724b1cb","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:0619efcc238bfd01a17ac8971f8f16d43797b16f46f3515e896aa28a8f511aaa

Text language: en · wiki-repair-20261023:0619efcc238bfd01a17ac8971f8f16d43797b16f46f3515e896aa28a8f511aaa