Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Jaromír KamlerDate: 2005-12-26 19:45:06
Subject:
Previous:From: Rana BiswasDate: 2005-12-26 13:55:47
Subject: Postgresql 8.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group