Обсуждение: Logs not Rotating

Поиск
Список
Период
Сортировка

Logs not Rotating

От
Mag Gam
Дата:
I have something like this:

redirect_stderr = true      # Enable capturing of stderr into log files.
log_directory = 'pg_log'    # Directory where log files are written.
log_filename = 'postgresql-%a.log' # Log file name pattern.
log_truncate_on_rotation = false  # If true, any existing log file of the
log_rotation_age = 10080     # Automatic rotation of logfiles will happen after
log_rotation_size = 1       # Automatic rotation of logfiles will happen after

But my logs are not rotating at all, is there something I should be aware of?

 PostgreSQL 8.0.5 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)

I also did pg_ctl restart, and pg_ctl reload

TIA

Re: Logs not Rotating

От
Tom Lane
Дата:
Mag Gam <magawake@gmail.com> writes:
> I have something like this:
> [looks reasonable other than a really small log_rotation_size]

> But my logs are not rotating at all, is there something I should be aware of?

What are you expecting to happen, and what do you see actually
happening?  Be specific.

            regards, tom lane

Re: Logs not Rotating

От
Mag Gam
Дата:
Tom:

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.

Also, I restarted syslogd, just to be sure....

Any suggestions?


On 12/24/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Mag Gam <magawake@gmail.com> writes:
> > I have something like this:
> > [looks reasonable other than a really small log_rotation_size]
>
> > But my logs are not rotating at all, is there something I should be aware of?
>
> What are you expecting to happen, and what do you see actually
> happening?  Be specific.
>
>                         regards, tom lane
>

Re: Logs not Rotating

От
Tom Lane
Дата:
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