Re: Patch to implement pg_current_logfile() function - Mailing list pgsql-hackers

From Christoph Berg
Subject Re: Patch to implement pg_current_logfile() function
Date
Msg-id 20161003140946.qfgjamzqkeu7rojj@msg.df7cb.de
Whole thread Raw
In response to Re: Patch to implement pg_current_logfile() function  (Gilles Darold <gilles.darold@dalibo.com>)
Responses Re: Patch to implement pg_current_logfile() function  (Gilles Darold <gilles.darold@dalibo.com>)
List 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



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Decoding proacl
Next
From: Christoph Berg
Date:
Subject: Re: Renaming of pg_xlog and pg_clog