PostgreSQL Metrics
Configuration Options
Required Options
endpoints(required)
PostgreSQL server endpoint in libpq-style connection strings.
Type | Syntax | Default | Example |
---|---|---|---|
array | literal | ["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.
Type | Syntax | Default | Example |
---|---|---|---|
string | literal | ["postgresql_metrics"] |
Advanced Options
scrape_interval_secs(optional)
The interval between scrapes.
Type | Syntax | Default | Example |
---|---|---|---|
uint | 15 |
namespace(optional)
The namespace of metrics. Disabled if empty.
Type | Syntax | Default | Example |
---|---|---|---|
string | literal | postgresql |
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
.
Type | Syntax | Default | Example |
---|---|---|---|
array | literal | ["^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
.
Type | Syntax | Default | Example |
---|---|---|---|
array | literal | ["^postgres$","^template.*",""] |
tls(optional)
TLS options to connect to the PostgreSQL Server.
Type | Syntax | Default | Example |
---|---|---|---|
hash | literal | [] |
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.