From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to get previous log file
Date: Sun, 28 Jun 2020 08:11:54 -0700
Message-ID: <838b1bf7-cdf0-2be7-cc28-9800f3bdee36@aklaver.com> (raw)
In-Reply-To: <7F15982900DB4EC0A233213D0ED79C70@dell2>
References: <7F15982900DB4EC0A233213D0ED79C70@dell2>
On 6/28/20 2:42 AM, Andrus wrote:
> Hi!
>
> select pg_read_file(pg_current_logfile())
> retrieves today log file.
> Log files are in log directory:
>
> /var/lib/postgresql/12/main/log# ls
> ...
> postgresql-2020-06-08_000000.logĀ postgresql-2020-06-18_000000.log
> postgresql-2020-06-28_000000.log
> postgresql-2020-06-09_000000.logĀ postgresql-2020-06-19_000000.log
>
> How get yesterday log file from remote client application using
> postgresql query ?
> Using Postgres 12 in Debian.
You where half way there:
https://www.postgresql.org/docs/12/functions-admin.html
pg_ls_dir() -- To get file names.
pg_read_file() -- Using file name from above.
>
> Andrus.
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, kobruleht2@hot.ee
Subject: Re: How to get previous log file
In-Reply-To: <838b1bf7-cdf0-2be7-cc28-9800f3bdee36@aklaver.com>
References: <7F15982900DB4EC0A233213D0ED79C70@dell2> <838b1bf7-cdf0-2be7-cc28-9800f3bdee36@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox