Using the adminpack

The idea behind the adminpack module is to give administrators a way to access the file system without SSH access. The package contains a couple of functions to make that possible.

To load the module into the database, run the following command:

test=# CREATE EXTENSION adminpack;CREATE EXTENSION

One of the most interesting features of the adminpack module is the ability to inspect log files. The pg_logdir_ls function checks out the log directory and returns a list of log files:

test=# SELECT * FROM pg_catalog.pg_logdir_ls() AS (a timestamp, b text);ERROR: the log_filename parameter must equal 'postgresql-%Y-%m-%d_%H%M%S.log'

The important thing here is that the log_filename parameter has to be adjusted to the adminspack ...

Get Mastering PostgreSQL 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.