/var/log/pgl/pgld.log {
    rotate 12
    daily
    compress
    delaycompress
    missingok
    notifempty
    prerotate
        # If pglcmd is installed, send statistics per mail.
        # The mail function forks a process that sleeps 5 seconds, so wait here longer.
        [ ! -x /usr/bin/pglcmd ] || (
        /usr/bin/pglcmd email_stats > /dev/null
        sleep 7
        )
    endscript
    postrotate
        # Reload pgld to reopen the logfile
        [ ! -e /var/run/pgld.pid ] || kill -s HUP $(cat /var/run/pgld.pid)
    endscript
}
