Re: Logs not Rotating - Mailing list pgsql-novice

From Tom Lane
Subject Re: Logs not Rotating
Date
Msg-id 9643.1135611146@sss.pgh.pa.us
Whole thread Raw
In response to Re: Logs not Rotating  (Mag Gam <magawake@gmail.com>)
List pgsql-novice
Mag Gam <magawake@gmail.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

pgsql-novice by date:

Previous
From: Mag Gam
Date:
Subject: Re: Logs not Rotating
Next
From: " Jaromír Kamler"
Date:
Subject: ...