[pgpool-hackers: 4446] Proposal: Add new PCP command to trigger log rotation

Bo Peng pengbo at sraoss.co.jp
Wed Apr 24 15:07:50 JST 2024


Currently the only way to trigger log rotation in logging collector process
is to send SIGUSR1 signal directly to logging collector process.  

However, I think it would be nice to have a better way to do it 
with an external tool (e.g. logrotate) without requiring knowledge
of the logging collector's PID.

This patch add a new PCP command "pcp_log_rotate" for triggering log rotation.
Regression test will be added in another patch.


How to run this command?

  pcp_log_rotate -h 127.0.0.1 -p 11001 -U pengbo


How to test this command?

1. Add the following configurations to pgpool.conf:

  logging_collector = on 
  log_directory = '/home/pengbo/pgpoolsetup/log'
  log_filename = 'pgpool.log'

2. Rename log file
   
   cd /home/pengbo/pgpoolsetup/log
   mv pgpool.log pgpool.log.1
   
3. Run pcp_log_rotate.
   Before running this command, Pgpool-II keeps writing logs to pgpool.log.1.
   After running this command, Pgpool-II will write logs to pgpool.log.

-- 
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS LLC
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcp_log_rotate_v1.patch
Type: application/octet-stream
Size: 18081 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20240424/c4707b18/attachment-0001.obj>


More information about the pgpool-hackers mailing list