On 09/28/2018 12:03 AM, Raghavendra Rao J S V wrote:
Does it have to be in postgresql.conf? A cron job which runs a few minutes after midnight works just fine. Compresses yesterday's log file and deletes files older than 30 days: #!/bin/bash
DIR=/var/lib/pgsql/data/pg_log
cd $DIR
PREVDT=$(date
-d "-1 day" +"%F")
bzip2 -9
postgresql-${PREVDT}.log
OLDFILES=$(find
$DIR/postgresql-*log* -mtime +30)
rm -v
$OLDFILES
--
Angular momentum makes the world go 'round. |