Re: Errorlog empty

From: Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>
To: "Rossi, Maria" <maria(dot)rossi(at)us(dot)pgds(dot)com>
Cc: Shreeyansh Dba <shreeyansh2014(at)gmail(dot)com>, Scott Ribe <scott_ribe(at)elevated-dev(dot)com>, Postgres Maillist <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Errorlog empty
Date: 2015-03-13 11:55:27
Message-ID: CAJghg4JK6+Wiv5yuoxMbSq+nSNmxK1wYnnwd930giNn+WimS1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Mar 13, 2015 at 7:02 AM, Rossi, Maria <maria(dot)rossi(at)us(dot)pgds(dot)com>
wrote:

> Also, we have a monitor that checks the errorlog. This monitor appends
> the current log to an archive file (example, errorlog.201503), then touch
> a new ‘error.log’. After the touch, the new errorlog is not written to
> anymore, until postgres is bounced. I should also note that new
> error.log is owned by the monitor ID:
>
>
That is a very important bit of information that you seem to have hidden
from the list since the beginning. If an external process is moving the
file that PostgreSQL is currently writting to, then it must somehow make
the PostgreSQL's logger process aware of that. To do that you can call
pg_rotate_logfile function:

$ psql -c "SELECT pg_rotate_logfile()"

Although if you remove the file before calling it, you can lose some
information in between, so I recommend using a log_filename that has
date/time information (like the default one), so you can call
pg_rotate_logfile, wait for PostgreSQL to create a new one, then you are
safe to move the old ones to whatever location you want.

Regards,
--
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Achilleas Mantzios 2015-03-13 13:16:14 Re: Samsung SSD 850 PRO 1T : any good for PostgreSQL?
Previous Message Joshua D. Drake 2015-03-13 11:40:31 Re: Samsung SSD 850 PRO 1T : any good for PostgreSQL?