log_line_prefix and JSON log format

Started by PG Bug reporting form20 days ago7 messagesdocs
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

This thread has been committed, so CI has stopped here. Anything below is the last result it produced.

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t253941
psql -h localhost -U postgres

Built from patchset v2 (message #2), September 25, 2026 at 03:24 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t253941_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t253941_2 && git checkout t253941_2

Patchset v2 (message #2) is on t253941_2

Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

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.

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: PG Bug reporting form (#1)
Re: log_line_prefix and JSON log format

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:

t253941_2
v1-0001-Doc-no-log_line_prefix-in-csvlog-or-jsonlog.patchtext/x-patch; charset=ISO-8859-1; name=v1-0001-Doc-no-log_line_prefix-in-csvlog-or-jsonlog.patchDownload+2-2
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Laurenz Albe (#2)
Re: log_line_prefix and JSON log format

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

#4Matemática A3K
matematica.a3k@gmail.com
In reply to: Tom Lane (#3)
Re: log_line_prefix and JSON log format

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

#5Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Tom Lane (#3)
Re: log_line_prefix and JSON log format

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

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Laurenz Albe (#5)
Re: log_line_prefix and JSON log format

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

#7Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Tom Lane (#6)
Re: log_line_prefix and JSON log format

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