pgsql: Add local-address escape "%L" to log_line_prefix.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add local-address escape "%L" to log_line_prefix.
Date: 2025-04-07 15:06:17
Message-ID: E1u1o3F-0038Vk-1v@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add local-address escape "%L" to log_line_prefix.

This escape shows the numeric server IP address that the client
has connected to. Unix-socket connections will show "[local]".
Non-client processes (e.g. background processes) will show "[none]".

We expect that this option will be of interest to only a fairly
small number of users. Therefore the implementation is optimized
for the case where it's not used (that is, we don't do the string
conversion until we have to), and we've not added the field to
csvlog or jsonlog formats.

Author: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Reviewed-by: Cary Huang <cary(dot)huang(at)highgo(dot)ca>
Reviewed-by: David Steele <david(at)pgmasters(dot)net>
Reviewed-by: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAKAnmmK-U+UicE-qbNU23K--Q5XTLdM6bj+gbkZBZkjyjrd3Ow@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3516ea768c92ad0abc16dc4dd97e5eef6eab4237

Modified Files
--------------
doc/src/sgml/config.sgml | 6 +++++
src/backend/utils/error/elog.c | 33 +++++++++++++++++++++++++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/libpq/libpq-be.h | 3 +++
4 files changed, 43 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2025-04-07 16:28:24 pgsql: Clean up error messages from 1495eff7bdb
Previous Message Tom Lane 2025-04-07 15:04:09 Re: pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate