As we known, the name of current log file depends on the number of seconds (for
simple, later I will call it last_syslogger_file_time) since Epoch when create
new log file. So, for this feature, the key is how syslogger process pass
last_syslogger_file_time to backend processes.
To pass last_syslogger_file_time, we have 2 solutions: 1, add a global
variable to record last_syslogger_file_time which shared by backends and
syslogger, so backends can get last_syslogger_file_time very easily; 2
syslogger process send last_syslogger_file_time to pgstat process when
last_syslogger_file_time changes, just as other auxiliary processes send stat
message to pgstat process, and pgstat process will write
last_syslogger_file_time into stat file so that backend can get
last_syslogger_file_time via reading this stat file.
For these 2 solutions, we prefer to later, because we want to keep the
global variables space much simpler.
On the other side, we need to add a new function named
pg_stat_get_log_file_name() which will return the current log file name
according to last_syslogger_file_time and log file name format.
If you have any question, please let me know.
------------------ Original ------------------
From: "Alvaro Herrera";<alvhe...@2ndquadrant.com>;
Date: Tue, Feb 2, 2016 06:30 PM
Subject: Re: [HACKERS] get current log file
> I find there is a new feature about getting current log file name on the
> TODO list (for detail please check
> On the other side, we finish a ticket to this requirement for our customer.
> If the PG community still need this feature, there will be a pleasure
> for us to make contribution.
Please propose a design and we'll discuss. There's clearly need for
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Service