Sorry, forgot forwarding the mail to the mail list. Please put some comments.
------------------ Jerry Yu https://github.com/scarbrofair ------------------ Original ------------------ From: "Armor";<yupengst...@qq.com>; Date: Tue, Feb 2, 2016 09:22 PM To: "Alvaro Herrera"<alvhe...@2ndquadrant.com>; Subject: Re: [HACKERS] get current log file 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. ------------------ Jerry Yu ------------------ Original ------------------ From: "Alvaro Herrera";<alvhe...@2ndquadrant.com>; Date: Tue, Feb 2, 2016 06:30 PM To: "Armor"<yupengst...@qq.com>; Cc: "pgsql-hackers"<pgsql-hackers@postgresql.org>; Subject: Re: [HACKERS] get current log file Armor wrote: > Hello, > > > I find there is a new feature about getting current log file name on the > TODO list (for detail please check > http://www.postgresql.org/message-id/pine.gso.4.64.0811101325260.9...@westnet.com). > 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 this feature. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Service