PostgreSQL Metrics

Configuration Options

Required Options

endpoints(required)

PostgreSQL server endpoint in libpq-style connection strings.

TypeSyntaxDefaultExample
arrayliteral["postgresql://postgres:vector@localhost:5432/postgres"]
type(required)

The component type. This is a required field for all components and tells Vector which component to use.

TypeSyntaxDefaultExample
stringliteral["postgresql_metrics"]

Advanced Options

scrape_interval_secs(optional)

The interval between scrapes.

TypeSyntaxDefaultExample
uint15
namespace(optional)

The namespace of metrics. Disabled if empty.

TypeSyntaxDefaultExample
stringliteralpostgresql
include_databases(optional)

A list of databases to match (by using POSIX Regular Expressions) against the datname column for which you want to collect metrics from. If not set, metrics are collected from all databases. Specifying "" will include metrics where datname is NULL. This can be used in conjunction with exclude_databases.

TypeSyntaxDefaultExample
arrayliteral["^postgres$","^vector$","^foo"]
exclude_databases(optional)

A list of databases to match (by using POSIX Regular Expressions) against the datname column for which you don't want to collect metrics from. Specifying "" will include metrics where datname is NULL. This can be used in conjunction with include_databases.

TypeSyntaxDefaultExample
arrayliteral["^postgres$","^template.*",""]
tls(optional)

TLS options to connect to the PostgreSQL Server.

TypeSyntaxDefaultExample
hashliteral[]

How it Works

Required Privileges

PostgreSQL Metrics component collects metrics by making queries to the configured PostgreSQL server. Ensure the configured user is allowed to make the select queries against the following views:

  • pg_stat_database
  • pg_stat_database_conflicts
  • pg_stat_bgwriter

State

This component is stateless, meaning its behavior is consistent across each input.

Context

By default, the postgresql_metrics source augments events with helpful context keys.