agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
log_line_prefix and JSON log format
7+ messages / 4 participants
[nested] [flat]

* log_line_prefix and JSON log format
@ 2026-09-25 09:32 PG Doc comments form <noreply@postgresql.org>
  2026-09-25 15:10 ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 7+ messages in thread

From: PG Doc comments form @ 2026-09-25 09:32 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: michael@schoenitzer.de

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/index.html
Description:

I noticed, that it not documented anywhere what log_line_prefix will do, if
log_destination = 'jsonlog' (Or CSV). From my tests it seems it is ignored
and does nothing. But we weren't sure and would be helpful to have this
documented.







^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: log_line_prefix and JSON log format
  2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
@ 2026-09-25 15:10 ` Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 15:36   ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: Laurenz Albe @ 2026-09-25 15:10 UTC (permalink / raw)
  To: michael@schoenitzer.de; pgsql-docs@lists.postgresql.org

On Fri, 2026-09-25 at 09:32 +0000, PG Doc comments form wrote:
> Page: https://www.postgresql.org/docs/18/index.html
> 
> I noticed, that it not documented anywhere what log_line_prefix will do, if
> log_destination = 'jsonlog' (Or CSV). From my tests it seems it is ignored
> and does nothing. But we weren't sure and would be helpful to have this
> documented.

True; here is a patch.

Yours,
Laurenz Albe

Attachments:

  [text/x-patch] v1-0001-Doc-no-log_line_prefix-in-csvlog-or-jsonlog.patch (1.4K, ../../42af2f4ed8afe739f2e8f8add80100b2ba2d7808.camel@cybertec.at/2-v1-0001-Doc-no-log_line_prefix-in-csvlog-or-jsonlog.patch)
  download | inline diff:
From 66a669efb0d65a9016d90aa49d7329d709b3776a Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@cybertec.at>
Date: Fri, 25 Sep 2026 17:04:38 +0200
Subject: [PATCH v1] Doc: no log_line_prefix in csvlog or jsonlog
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The documentation didn't make clear that "log_line_prefix" is
not output if "log_destination" is "csvlog" or "jsonlog".

Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reported-by: Michael Schönitzer <michael@schoenitzer.de>
Discussion: https://postgr.es/m/179032875673.1026201.6950455317699774504@wrigleys.postgresql.org
---
 doc/src/sgml/config.sgml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 0165eb9ec02..f277d311232 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -8224,7 +8224,8 @@ local0.*    /var/log/postgresql
       <listitem>
        <para>
          This is a <function>printf</function>-style string that is output at the
-         beginning of each log line.
+         beginning of each log line, except when <varname>log_destination</varname>
+         is <literal>csvlog</literal> or <literal>jsonlog</literal>.
          <literal>%</literal> characters begin <quote>escape sequences</quote>
          that are replaced with status information as outlined below.
          Unrecognized escapes are ignored. Other
-- 
2.55.0



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: log_line_prefix and JSON log format
  2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
  2026-09-25 15:10 ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
@ 2026-09-25 15:36   ` Tom Lane <tgl@sss.pgh.pa.us>
  2026-09-25 16:14     ` Re: log_line_prefix and JSON log format Matemática A3K <matematica.a3k@gmail.com>
  2026-09-25 22:13     ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 2 replies; 7+ messages in thread

From: Tom Lane @ 2026-09-25 15:36 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: michael@schoenitzer.de; pgsql-docs@lists.postgresql.org

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Fri, 2026-09-25 at 09:32 +0000, PG Doc comments form wrote:
>> I noticed, that it not documented anywhere what log_line_prefix will do, if
>> log_destination = 'jsonlog' (Or CSV). From my tests it seems it is ignored
>> and does nothing. But we weren't sure and would be helpful to have this
>> documented.

> True; here is a patch.

This wording seems like it might add confusion rather than remove it,
because it's not allowing for the fact that log_destination can be
a list.  I'd be inclined to write something more along the lines of
"... string that is output at the beginning of each log line that is
sent to stderr, syslog, or eventlog".

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: log_line_prefix and JSON log format
  2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
  2026-09-25 15:10 ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 15:36   ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
@ 2026-09-25 16:14     ` Matemática A3K <matematica.a3k@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Matemática A3K @ 2026-09-25 16:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; michael@schoenitzer.de; pgsql-docs@lists.postgresql.org

On Fri, Sep 25, 2026 at 12:36 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Laurenz Albe <laurenz.albe@cybertec.at> writes:
> > On Fri, 2026-09-25 at 09:32 +0000, PG Doc comments form wrote:
> >> I noticed, that it not documented anywhere what log_line_prefix will
> do, if
> >> log_destination = 'jsonlog' (Or CSV). From my tests it seems it is
> ignored
> >> and does nothing. But we weren't sure and would be helpful to have this
> >> documented.
>
> > True; here is a patch.
>
> This wording seems like it might add confusion rather than remove it,
> because it's not allowing for the fact that log_destination can be
> a list.  I'd be inclined to write something more along the lines of
> "... string that is output at the beginning of each log line that is
> sent to stderr, syslog, or eventlog".
>
>                         regards, tom lane
>

I agree with Tom

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: log_line_prefix and JSON log format
  2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
  2026-09-25 15:10 ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 15:36   ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
@ 2026-09-25 22:13     ` Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 22:21       ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 7+ messages in thread

From: Laurenz Albe @ 2026-09-25 22:13 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: michael@schoenitzer.de; pgsql-docs@lists.postgresql.org

On Fri, 2026-09-25 at 11:36 -0400, Tom Lane wrote:
> Laurenz Albe <laurenz.albe@cybertec.at> writes:
> > On Fri, 2026-09-25 at 09:32 +0000, PG Doc comments form wrote:
> > > I noticed, that it not documented anywhere what log_line_prefix will do, if
> > > log_destination = 'jsonlog' (Or CSV). From my tests it seems it is ignored
> > > and does nothing. But we weren't sure and would be helpful to have this
> > > documented.
> 
> > True; here is a patch.
> 
> This wording seems like it might add confusion rather than remove it,
> because it's not allowing for the fact that log_destination can be
> a list.  I'd be inclined to write something more along the lines of
> "... string that is output at the beginning of each log line that is
> sent to stderr, syslog, or eventlog".

No objection to your wording.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: log_line_prefix and JSON log format
  2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
  2026-09-25 15:10 ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 15:36   ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
  2026-09-25 22:13     ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
@ 2026-09-25 22:21       ` Tom Lane <tgl@sss.pgh.pa.us>
  2026-09-27 12:08         ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2026-09-25 22:21 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: michael@schoenitzer.de; pgsql-docs@lists.postgresql.org

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Fri, 2026-09-25 at 11:36 -0400, Tom Lane wrote:
>> I'd be inclined to write something more along the lines of
>> "... string that is output at the beginning of each log line that is
>> sent to stderr, syslog, or eventlog".

> No objection to your wording.

OK, I'll adapt your patch.

			regards, tom lane






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: log_line_prefix and JSON log format
  2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
  2026-09-25 15:10 ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 15:36   ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
  2026-09-25 22:13     ` Re: log_line_prefix and JSON log format Laurenz Albe <laurenz.albe@cybertec.at>
  2026-09-25 22:21       ` Re: log_line_prefix and JSON log format Tom Lane <tgl@sss.pgh.pa.us>
@ 2026-09-27 12:08         ` Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 0 replies; 7+ messages in thread

From: Laurenz Albe @ 2026-09-27 12:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: michael@schoenitzer.de; pgsql-docs@lists.postgresql.org

On Fri, 2026-09-25 at 18:21 -0400, Tom Lane wrote:
> Laurenz Albe <laurenz.albe@cybertec.at> writes:
> > On Fri, 2026-09-25 at 11:36 -0400, Tom Lane wrote:
> > > I'd be inclined to write something more along the lines of
> > > "... string that is output at the beginning of each log line that is
> > > sent to stderr, syslog, or eventlog".
> 
> > No objection to your wording.
> 
> OK, I'll adapt your patch.

Thanks for picking this up and improving it.

Yours,
Laurenz Albe






^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-09-27 12:08 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 09:32 log_line_prefix and JSON log format PG Doc comments form <noreply@postgresql.org>
2026-09-25 15:10 ` Laurenz Albe <laurenz.albe@cybertec.at>
2026-09-25 15:36   ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-25 16:14     ` Matemática A3K <matematica.a3k@gmail.com>
2026-09-25 22:13     ` Laurenz Albe <laurenz.albe@cybertec.at>
2026-09-25 22:21       ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-27 12:08         ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox