[pgpool-general: 5928] Re: pgpool.log rotation

Tatsuo Ishii ishii at sraoss.co.jp
Tue Feb 20 17:23:27 JST 2018

> Hi,
> I have installed pgpool 2 version 3.7.0 . I'm trying to configure log
> rotation on the pgpool.log but It seems that something wrong. I configured
> in logrotate conf file the parameters :
> /PostgreSQL/pgpool/log/pgpool.log {
>         daily
>         dateext
>         missingok
>         compress
>         notifempty
>         maxage 7
>         maxsize 21118320640
>                 rotate 7
>                 create 644 postgres postgres
>                 postrotate
>         su - postgres -c "~/pgpool/bin/pgpool reload"
>                 endscript
> }
> After the first rotation, an archive is generated but the pool stops
> writing to the original log. Any idea what can be the reason ?

Because Pgpool-II does not the close log file upon receiving SIGHUP
(issued by reload). 

> If this isnt the way can you recommend how to do rotation on pgpool`s log ?

Probably the easiest way to do it is setting log_destination = 'syslog'.

Another way to rotate logs is using Apache's rotatelogs program:

~/pgpool -n 2>&1 | rotatelogs -f -n 3 > /PostgreSQL/pgpool/log/pgpool.log 10M

Will create and rotate pgpool.log, pgpool.log.1, pgpool.log.2 under
/PostgreSQL/pgpool/log every time current log file exceeds 10M.

I think you could use logrotate if you have a program which reads the
log stream from stdin and write out it to specified file. Also it
needs to accept some signals (for example SIGHUP) then close and open
the log file. Perhaps it is not terribly hard to create such that
program. Or even there's already such a program but I don't know.

Best regards,
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php

More information about the pgpool-general mailing list