Thread: How to get previous log file
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. Andrus.
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