PostgreSQL

Configure PostgreSQL Log Source with observIQ

Supported Versions

PostgreSQL versions

  • 12
  • 11
  • 10
  • 9.6

Prerequisites

Locate the local PostgreSQL postgresql.conf configuration file.

πŸ“˜

Finding the postgresql.conf file

This file is typically located in the database data_directory. For more information, see the PostgreSQL documentation..

Modify the postgresql.conf file with the following logging parameters. Changes should go under the ERROR REPORTING AND LOGGING section of the file.

log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'        
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = off
log_rotation_age = 1d
log_min_duration_statement = 0
log_connections = on
log_duration = on
log_hostname = on
log_timezone = 'UTC'
log_line_prefix = 't=%t p=%p s=%c l=%l u=%u db=%d r=%r '

πŸ“˜

PostgreSQL Configuration File

For more details on the log parameters, Click here

After editing the postgresql.conf file, you will need to restart the postgres server:

sudo service postgresql restart

Configuration

Option

Description

PostgresSQL Log Path

Use this field to verify the path to the PostgresSQL log file and adjust default as needed (/var/lib/pgsql//data/pg_log/postgresql-.log).

Start At

Choose whether to start reading from the beginning or end of a file with "end" being the default.

πŸ“˜

PostgreSQL Log Locations

If no parameters were changed from the above postgresql.conf file, the logs location will be located under the PostgreSQL servers [data_directory]/pg_log.

For more information, Click here.

Log Types

Types

postgresql.general

postgresql.slow_query

Dashboards

After creating or updating or a PostgreSQL Source, the [oiq] PostgreSQL- Overview Dashboard and accompanying visualizations will be installed to your account automatically.

Advanced

For more information on the advanced configuration capabilities, see our detailed plugin guide here.