How to enable pg_log for postgresql 9.4 and later versions
search cancel

How to enable pg_log for postgresql 9.4 and later versions

book

Article ID: 295258

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

From postgresql 9.4, pg_log files is disabled by default. We can set some parameters to enable it.

The most critical settings are log_destination, logging_collector, and log_directory:
 
  • log_destination specifies where to log.
  • logging_collector is used to enable/disable capturing of stderr and csvlog.
  • log_directory specifies the location of pg_log directory, we can set it any other name we like.


Resolution

We can set set log_destination to 'csvlog'. To make it take effect, we also need to set logging_collector 'on'. For log_directory, we can set it to any other name than 'pg_log'.

After setting all these parameters, we need to restart the Postgresql instance to make it effective.