﻿---
title: PostgreSQL activity metricset
description: This is the activity metricset of the PostgreSQL module. This is a default metricset. If the host module is unconfigured, this metricset is enabled by...
url: https://www.elastic.co/elastic/docs-builder/docs/2840/reference/beats/metricbeat/metricbeat-metricset-postgresql-activity
products:
  - Beats
  - Metricbeat
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# PostgreSQL activity metricset
This is the `activity` metricset of the PostgreSQL module.
This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

## Fields

For a description of each field in the metricset, see the [exported fields](https://www.elastic.co/elastic/docs-builder/docs/2840/reference/beats/metricbeat/exported-fields-postgresql) section.
Here is an example document generated by this metricset:
```json
{
    "@timestamp": "2017-10-12T08:05:34.853Z",
    "event": {
        "dataset": "postgresql.activity",
        "duration": 115000,
        "module": "postgresql"
    },
    "metricset": {
        "name": "activity",
        "period": 10000
    },
    "postgresql": {
        "activity": {
            "application_name": "",
            "backend_start": "2021-03-05T19:01:40.467Z",
            "backend_type": "client backend",
            "client": {
                "address": "192.168.128.1",
                "hostname": "",
                "port": 33414
            },
            "database": {
                "name": "postgres",
                "oid": 13395
            },
            "pid": 2236,
            "query": "SELECT * FROM pg_stat_activity",
            "query_start": "2021-03-05T19:01:40.469Z",
            "state": "idle",
            "state_change": "2021-03-05T19:01:40.471Z",
            "user": {
                "id": 10,
                "name": "postgres"
            }
        }
    },
    "service": {
        "address": "192.168.128.2:5432",
        "type": "postgresql"
    }
}
```