Re: Current log files when rotating?

Поиск
Список
Период
Сортировка
От brian
Тема Re: Current log files when rotating?
Дата
Msg-id 4918843A.808@zijn-digital.com
обсуждение исходный текст
Ответ на Current log files when rotating?  (Greg Smith <gsmith@gregsmith.com>)
Список pgsql-general
Greg Smith wrote:
> Let's say you're using logging_collector and you've put some %-escapes
> into log_filename for daily log rotation.  Perhaps it's daily rotation
> with this pattern:
>
> log_filename = 'postgresql-%Y-%m-%d.log'
>
> Is there any good way to ask the server what log file name it's
> currently writing to?  I was trying to write something that does a
> "tail" on the current log, and was hoping there was a simple way to
> figure out which file that goes against.  Looking for the latest
> timestamp or running strftime would both work I guess, those just seemed
> a little heavy (was hoping for an "alias"-sized answer) to figure out
> something that the server certainly knows.
>

As long as you're using a reasonable[1] format for the date, you could
simply list postgresql-*.log and grab the last filename.

[1] eg. Year-Month-day, which will always be ordered properly.

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Current log files when rotating?
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Current log files when rotating?