Re: Logging which local address was connected to in log_line_prefix

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Greg Sabino Mullane <htamfids@gmail.com>, Jim Jones <jim.jones@uni-muenster.de>, david@pgmasters.net, Peter Eisentraut <peter@eisentraut.org>, Cary Huang <cary.huang@highgo.ca>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-06T22:53:14Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add local-address escape "%L" to log_line_prefix.

Michael Paquier <michael@paquier.xyz> writes:
> I'd suggest the addition of this data to csvlog.c and jsonlog.c,
> perhaps only adding this information if local_host[0] is not '\0'
> rather than assigning a default "[none]" all the time to save some
> space in the entries generated.

I think that's completely impractical for csvlog: changing the row
type for CSV output is a serious compatibility break, and there is
exactly zero evidence that the local address info is worth that.

JSON has less of a compatibility problem, but I still doubt that
the local address info is worth the space it'd take, for about
99% of users.  Also note that we have no good way for the user
to specify what fields she wants in jsonlog, otherwise we could
make it appear only if asked for.

			regards, tom lane