Re: Patch to implement pg_current_logfile() function

From: Christoph Berg <myon(at)debian(dot)org>
To: Gilles Darold <gilles(dot)darold(at)dalibo(dot)com>
Cc: "Karl O(dot) Pinc" <kop(at)meme(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to implement pg_current_logfile() function
Date: 2016-10-03 14:09:46
Message-ID: 20161003140946.qfgjamzqkeu7rojj@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Gilles,

I've just tried v4 of the patch. The OID you picked for
pg_current_logfile doesn't work anymore, but after increasing it
randomly by 10000, it compiles. I like the added functionality,
especially that "select pg_read_file(pg_current_logfile());" just
works.

What bugs me is the new file "pg_log_file" in PGDATA. It clutters the
directory listing. I wouldn't know where else to put it, but you might
want to cross-check that with the thread that is trying to reshuffle
the directory layout to make it easier to exclude files from backups.
(Should this file be part of backups?)

It's probably correct to leave the file around on shutdown (given it's
still a correct pointer). But there might be a case for removing it on
startup if logging_collector isn't active anymore.

Also, pg_log_file is tab-completion-unfriendly, it conflicts with
pg_log/. Maybe name it current_logfile?

Another thing that might possibly be improved is csv logging:

# select pg_read_file(pg_current_logfile());
pg_read_file
───────────────────────────────────────────────────────────────
LOG: ending log output to stderr ↵
HINT: Future log output will go to log destination "csvlog".↵

-rw------- 1 cbe staff 1011 Okt 3 15:06 postgresql-2016-10-03_150602.csv
-rw------- 1 cbe staff 96 Okt 3 15:06 postgresql-2016-10-03_150602.log

... though it's unclear what to do if both stderr and csvlog are
selected.

Possibly NULL should be returned if only "syslog" is selected.
(Maybe remove pg_log_file once 'HINT: Future log output will go to
log destination "syslog".' is logged?)

Christoph

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2016-10-03 14:20:00 Re: Renaming of pg_xlog and pg_clog
Previous Message Stephen Frost 2016-10-03 13:52:39 Re: Decoding proacl