Re: log rotation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Guerin <guerin(at)rentec(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: log rotation
Date: 2006-03-18 15:26:15
Message-ID: 16076.1142695575@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Michael Guerin <guerin(at)rentec(dot)com> writes:
> Can I get rid of the number extension at the end of my log file
> name? What I'd like to do is keep one log file that truncates after a
> certain amount of time or size, however postgres keeps appending to the
> name I choose?

You haven't really thought this through: what would happen after the
file filled up? If Postgres truncates it then you'd instantly lose
all log entries before that time, which is surely not what you want.

The usual arrangement is to set up a rotating cycle of log file names,
such as one for each day of the week if you want a week's worth of log
history, or one for each hour of the day if you want a day's worth,
etc. Then the oldest file gets truncated and rewritten each time the
logger shifts to a new file name. To do this, you change log_filename
to use a suitable %-item in the file name. See the examples in the manual.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruce Momjian 2006-03-19 02:14:43 Re: Multiple insertion
Previous Message operationsengineer1 2006-03-17 20:49:29 Re: Postgres crashes