I recently upgraded to Postgresql 9.6 and PgAdmin 4.

Now, one handy feature of PgAdmin 3 was the "server status" window, which I used to look at the log file.

I can't find that in PgAdmin 4. How can I view the server log in PgAdmin 4? Or is there a nice alternative?

  • vim is a decent alternative
    – Philᵀᴹ
    Nov 1, 2016 at 14:57

1 Answer 1


I have followed the guide here to use a foreign data wrapper so I can access the log file through SQL.

First, create the extension:

create extension file_fdw;

Next, set up postgres.conf to support csv logging. Essentially, these settings:




And also the following, from the documentation:

Set log_filename and log_rotation_age to provide a consistent, predictable naming scheme for your log files. This lets you predict what the file name will be and know when an individual log file is complete and therefore ready to be imported.

Set log_rotation_size to 0 to disable size-based log rotation, as it makes the log file name difficult to predict.

Set log_truncate_on_rotation to on so that old log data isn't mixed with the new in the same file.

Create, the server and the table, and the log can be queried!

create server logserver FOREIGN DATA WRAPPER file_fdw;

  log_time timestamp(3) with time zone,
  user_name text,
  database_name text,
  process_id integer,
  connection_from text,
  session_id text,
  session_line_num bigint,
  command_tag text,
  session_start_time timestamp with time zone,
  virtual_transaction_id text,
  transaction_id bigint,
  error_severity text,
  sql_state_code text,
  message text,
  detail text,
  hint text,
  internal_query text,
  internal_query_pos integer,
  context text,
  query text,
  query_pos integer,
  location text,
  application_name text)
SERVER logserver OPTIONS (filename 'pg_log/postgresql.csv', format 'csv');

select message from postgres_log;
  • should be log_filename='postgresql, NOT postgresql.log Sep 28, 2017 at 21:25
  • Thanks for answering your own question :D Aug 24, 2020 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.