Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/postgresql/_dev/deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ARG SERVICE_VERSION=${SERVICE_VERSION:-9.5.3}
FROM postgres:${SERVICE_VERSION}
FROM postgres:17.5
COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d
HEALTHCHECK --interval=10s --retries=6 CMD psql -h localhost -U postgres -l
2 changes: 2 additions & 0 deletions packages/postgresql/_dev/deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ services:
- 5432
volumes:
- ${SERVICE_LOGS_DIR}/postgresql:/var/log/postgresql
environment:
- POSTGRES_PASSWORD=postgres
6 changes: 3 additions & 3 deletions packages/postgresql/_dev/deploy/variants.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variants:
v9_5_3:
SERVICE_VERSION: 9.5.3
default: v9_5_3
v17_5:
SERVICE_VERSION: 17.5
default: v17_5
5 changes: 5 additions & 0 deletions packages/postgresql/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.40.0"
changes:
- description: Upgrade supported PostgreSQL version to 17.5.
type: enhancement
link: https://github.com/elastic/integrations/pull/15597
- version: "1.31.0"
changes:
- description: Allow @custom pipeline access to event.original without setting preserve_original_event.
Expand Down
81 changes: 30 additions & 51 deletions packages/postgresql/data_stream/activity/sample_event.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,52 @@
{
"@timestamp": "2024-04-30T09:14:50.873Z",
"@timestamp": "2025-08-04T11:18:45.293Z",
"agent": {
"ephemeral_id": "f065ed3c-78fb-41da-9fe6-88ab3ff0f088",
"id": "69c77328-4412-45c4-8f98-cc7e7b1fc216",
"name": "docker-fleet-agent",
"ephemeral_id": "30c960ab-2783-4872-b8f2-747d3fd22516",
"id": "b36acb54-cf84-4518-a468-71f4bc0cc44a",
"name": "elastic-agent-41460",
"type": "metricbeat",
"version": "8.13.0"
"version": "8.16.0"
},
"data_stream": {
"dataset": "postgresql.activity",
"namespace": "ep",
"namespace": "88740",
"type": "metrics"
},
"database": {
"oid": 12379
},
"ecs": {
"version": "8.11.0"
"version": "8.0.0"
},
"elastic_agent": {
"id": "69c77328-4412-45c4-8f98-cc7e7b1fc216",
"id": "b36acb54-cf84-4518-a468-71f4bc0cc44a",
"snapshot": false,
"version": "8.13.0"
"version": "8.16.0"
},
"event": {
"agent_id_status": "verified",
"dataset": "postgresql.activity",
"duration": 6165334,
"ingested": "2024-04-30T09:15:02Z",
"duration": 22551727,
"ingested": "2025-08-04T11:18:48Z",
"module": "postgresql"
},
"host": {
"architecture": "x86_64",
"containerized": true,
"hostname": "docker-fleet-agent",
"id": "8259e024976a406e8a54cdbffeb84fec",
"containerized": false,
"hostname": "elastic-agent-41460",
"ip": [
"192.168.251.4"
"172.18.0.4",
"172.25.0.2"
],
"mac": [
"02-42-C0-A8-FB-04"
"6A-0E-5F-3C-38-88",
"FE-F8-13-97-42-E8"
],
"name": "docker-fleet-agent",
"name": "elastic-agent-41460",
"os": {
"codename": "focal",
"family": "debian",
"kernel": "3.10.0-1160.99.1.el7.x86_64",
"name": "Ubuntu",
"platform": "ubuntu",
"family": "",
"kernel": "6.10.14-linuxkit",
"name": "Wolfi",
"platform": "wolfi",
"type": "linux",
"version": "20.04.6 LTS (Focal Fossa)"
"version": "20230201"
}
},
"metricset": {
Expand All @@ -58,33 +55,15 @@
},
"postgresql": {
"activity": {
"application_name": "",
"backend_start": "2024-04-30T09:14:50.875Z",
"client": {
"address": "192.168.251.4",
"hostname": "",
"port": 49266
},
"database": {
"name": "postgres",
"oid": 12379
},
"pid": 113,
"query": "SELECT * FROM pg_stat_activity",
"query_id": "W/d3kCHhA8b/M4YpzDBJHlJM7xU=",
"query_start": "2024-04-30T09:14:50.877Z",
"state": "active",
"state_change": "2024-04-30T09:14:50.877Z",
"transaction_start": "2024-04-30T09:14:50.877Z",
"user": {
"id": 10,
"name": "postgres"
},
"waiting": false
"backend_start": "2025-08-04T11:18:23.847Z",
"backend_type": "autovacuum launcher",
"pid": 69,
"wait_event": "AutovacuumMain",
"wait_event_type": "Activity"
}
},
"service": {
"address": "postgres://elastic-package-service-postgresql-1:5432?connect_timeout=10&sslmode=disable",
"address": "postgres://svc-postgresql:5432?connect_timeout=10&sslmode=disable",
"type": "postgresql"
}
}
}
69 changes: 27 additions & 42 deletions packages/postgresql/data_stream/bgwriter/sample_event.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
{
"@timestamp": "2022-01-12T03:38:29.389Z",
"@timestamp": "2025-08-04T11:19:45.381Z",
"agent": {
"ephemeral_id": "24686799-f7eb-4c30-b72d-8936c5c0546a",
"id": "9878d192-22ad-49b6-a6c2-9959b0815d04",
"name": "docker-fleet-agent",
"ephemeral_id": "fa6e155e-abc0-4afb-9af8-5c95e3add05a",
"id": "9e9b065c-94e2-42c0-8d10-9005f4df537a",
"name": "elastic-agent-98211",
"type": "metricbeat",
"version": "8.0.0-beta1"
"version": "8.16.0"
},
"data_stream": {
"dataset": "postgresql.bgwriter",
"namespace": "ep",
"namespace": "43672",
"type": "metrics"
},
"ecs": {
"version": "8.11.0"
"version": "8.0.0"
},
"elastic_agent": {
"id": "9878d192-22ad-49b6-a6c2-9959b0815d04",
"id": "9e9b065c-94e2-42c0-8d10-9005f4df537a",
"snapshot": false,
"version": "8.0.0-beta1"
"version": "8.16.0"
},
"event": {
"agent_id_status": "verified",
"dataset": "postgresql.bgwriter",
"duration": 16119001,
"ingested": "2022-01-12T03:38:30Z",
"duration": 19163200,
"ingested": "2025-08-04T11:19:48Z",
"module": "postgresql"
},
"host": {
"architecture": "x86_64",
"containerized": true,
"hostname": "docker-fleet-agent",
"id": "4ccba669f0df47fa3f57a9e4169ae7f1",
"containerized": false,
"hostname": "elastic-agent-98211",
"ip": [
"172.18.0.4"
"172.18.0.4",
"172.25.0.2"
],
"mac": [
"02-42-C0-A8-FB-04"
"16-D1-3C-3E-52-C0",
"52-11-95-E5-54-9D"
],
"name": "docker-fleet-agent",
"name": "elastic-agent-98211",
"os": {
"codename": "Core",
"family": "redhat",
"kernel": "5.11.0-44-generic",
"name": "CentOS Linux",
"platform": "centos",
"family": "",
"kernel": "6.10.14-linuxkit",
"name": "Wolfi",
"platform": "wolfi",
"type": "linux",
"version": "7 (Core)"
"version": "20230201"
}
},
"metricset": {
Expand All @@ -56,30 +56,15 @@
"postgresql": {
"bgwriter": {
"buffers": {
"allocated": 187,
"backend": 0,
"backend_fsync": 0,
"checkpoints": 0,
"allocated": 150,
"clean": 0,
"clean_full": 0
},
"checkpoints": {
"requested": 0,
"scheduled": 0,
"times": {
"sync": {
"ms": 0
},
"write": {
"ms": 0
}
}
},
"stats_reset": "2022-01-12T03:38:06.524Z"
"stats_reset": "2025-08-04T11:19:23.197Z"
}
},
"service": {
"address": "postgres://elastic-package-service-postgresql-1:5432?connect_timeout=10&sslmode=disable",
"address": "postgres://svc-postgresql:5432?connect_timeout=10&sslmode=disable",
"type": "postgresql"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vars:
hosts:
- postgres://{{Hostname}}:{{Port}}?sslmode=disable
username: postgres
password: postgres
data_stream:
vars: ~
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
metricsets: ["query"]
hosts:
- "postgres://postgres:postgres@postgres-17:5432/postgres?sslmode=disable"
{{#if condition}}
condition: {{ condition }}
{{/if}}
driver: "postgres"
sql_queries:
- query: "SELECT * FROM pg_stat_checkpointer;"
response_format: table
raw_data.enabled: true
period: {{period}}
{{#if ssl}}
ssl: {{ssl}}
{{/if}}
{{#if processors}}
processors:
{{processors}}
{{/if}}
94 changes: 94 additions & 0 deletions packages/postgresql/data_stream/checkpointer/fields/agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
- name: cloud
title: Cloud
group: 2
description: Fields related to the cloud or infrastructure the events are coming from.
footnote: 'Examples: If Metricbeat is running on an EC2 host and fetches data from its host, the cloud info contains the data about this machine. If Metricbeat runs on a remote machine outside the cloud and fetches data from a service running in the cloud, the field contains cloud data from the machine the service is running on.'
type: group
fields:
- name: account.id
level: extended
type: keyword
ignore_above: 1024
dimension: true
description: 'The cloud account or organization id used to identify different entities in a multi-tenant environment. Examples: AWS account id, Google Cloud ORG Id, or other unique identifier.'
example: 666777888999
- name: availability_zone
level: extended
type: keyword
ignore_above: 1024
dimension: true
description: Availability zone in which this host is running.
example: us-east-1c
- name: instance.id
level: extended
type: keyword
ignore_above: 1024
description: Instance ID of the host machine.
example: i-1234567890abcdef0
dimension: true
- name: provider
level: extended
type: keyword
ignore_above: 1024
description: Name of the cloud provider. Example values are aws, azure, gcp, or digitalocean.
example: aws
dimension: true
- name: region
level: extended
type: keyword
ignore_above: 1024
dimension: true
description: Region in which this host is running.
example: us-east-1
- name: image.id
type: keyword
description: Image ID for the cloud instance.
- name: container
title: Container
group: 2
description: 'Container fields are used for meta information about the specific container that is the source of information. These fields help correlate data based containers from any runtime.'
type: group
fields:
- name: id
level: core
type: keyword
ignore_above: 1024
description: Unique container id.
dimension: true
- name: host
title: Host
group: 2
description: 'A host is defined as a general computing instance. ECS host.* fields should be populated with details about the host on which the event happened, or from which the measurement was taken. Host types include hardware, virtual machines, Docker containers, and Kubernetes nodes.'
type: group
fields:
- name: name
level: core
type: keyword
ignore_above: 1024
dimension: true
description: 'Name of the host. It can contain what `hostname` returns on Unix systems, the fully qualified domain name, or a name specified by the user. The sender decides which value to use.'
- name: containerized
type: boolean
description: >
If the host is a container.

- name: os.build
type: keyword
example: "18D109"
description: >
OS build information.

- name: os.codename
type: keyword
example: "stretch"
description: >
OS codename, if any.

- name: agent
title: Agent
type: group
fields:
- name: id
type: keyword
ignore_above: 1024
dimension: true
Loading