[pgpool-hackers: 3789] Re: Proposal: Add log_disconnections parameter

Tatsuo Ishii ishii at sraoss.co.jp
Thu Aug 20 15:52:02 JST 2020


Hi Hoshiai-san,

The patch looks good to me!

> Hi,
> 
> On 2020/08/18 17:31, Tatsuo Ishii wrote:
>>> Hi Ishii-san,
>>>
>>> I have fixed a previous proposal patch about log_disconnections
>>> paramter. A session time is added in log message.
>>>
>>> A previous mail is:
>>> [pgpool-hackers: 3656] Re: Proposal: Add log_disconnections parameter
>>>
>>>
>>> e.g.
>>> enable log_connections and log_disconnections, and execute the
>>> following query
>>>    psql -p 11000 test -c "SELECT pg_sleep(5)"
>>>
>>> == log messages ======
>>> 2020-08-13 18:04:39: child pid 10830: LOG:  new connection received
>>> 2020-08-13 18:04:39: child pid 10830: DETAIL:  connecting host=[local]
>>> 2020-08-13 18:04:39: psql pid 10830: LOG: pool_reuse_block: blockid: 0
>>> 2020-08-13 18:04:39: psql pid 10830: CONTEXT: while searching system
>>> catalog, When relcache is missed
>>> 2020-08-13 18:04:44: psql pid 10830: LOG:  frontend connection closed
>>> 2020-08-13 18:04:44: psql pid 10830: DETAIL: connected host=[local]
>>> session time: 0:00:05.037
>>> =====================
>> Isn't it better the message format of log_disconnections matches with
>> PostgreSQL's message? It's something like:
>> 	ereport(LOG,
>> 			(errmsg("disconnection: session time: %d:%02d:%02d.%03d "
>> 					"user=%s database=%s host=%s%s%s",
>> 					hours, minutes, seconds, msecs,
>> 					port->user_name, port->database_name, port->remote_host,
>> 					port->remote_port[0] ? " port=" : "", port->remote_port)));
>> (in log_disconnections() of src/backend/tcop/postgres.c)
> 
> Thank you for your advice.I think so, too.
> I reflected it to my patch.
> 
> $ psql -p 11000 test -c "SELECT pg_sleep(3);"
> 2020-08-20 14:16:30: psql pid 4108:LOG:  new connection received
> 2020-08-20 14:16:30: psql pid 4108:DETAIL:  connecting host=[local]
> 2020-08-20 14:16:33: psql pid 4108:LOG: frontend disconnection:
> session time: 0:00:03.007 user=hoshiai database=test host=[local]
> 
> 
>> Best regards,
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese:http://www.sraoss.co.jp
>> 
> 
> Best Regards,
> -- 
> Takuma Hoshiai <hoshiai.takuma at nttcom.co.jp>


More information about the pgpool-hackers mailing list