Re: Logs not Rotating

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mag Gam <magawake(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Logs not Rotating
Date: 2005-12-26 15:32:26
Message-ID: 9643.1135611146@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Mag Gam <magawake(at)gmail(dot)com> writes:
> I am expecting my logs to rotate on a weekly basis. I set the
> log_rotation_size = 1 for a quick result. Basically when a log is
> over 1k it should be rotated, which happens very quickly for me.
> However, file is increasing, and no rotation.

Well, the problem is that you set it up so that sub-daily rotation
doesn't do anything: the filename pattern is 'postgresql-%a.log'
which means that any filename generated on, say, Tuesday is going
to look the same. So the "rotation" action consists of re-opening
the same log file (and appending to it, not truncating it, so that
there's no visible effect).

If you want the thing to change log filenames oftener than once a
day, you need a suitable pattern. There are a couple of examples
of sane combinations of parameters in the docs:
http://www.postgresql.org/docs/8.1/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHERE
(look under log_truncate_on_rotation). Basically, if you want to
rotate on size, you need the filename pattern to include a component
that is shorter duration than the normal time-driven rotation would
require.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jaromír Kamler 2005-12-26 19:45:06
Previous Message Rana Biswas 2005-12-26 13:55:47 Postgresql 8.1