# Sql/metrics input in Elastic Agent not returning data (v8.14.3, PostgreSQL 17.2)

**URL:** <https://discuss.elastic.co/t/sql-metrics-input-in-elastic-agent-not-returning-data-v8-14-3-postgresql-17-2/378128>\
**Category:** Elastic Agent\
**Created:** [May 14, 2025, 10:12am UTC](https://discuss.elastic.co/t/sql-metrics-input-in-elastic-agent-not-returning-data-v8-14-3-postgresql-17-2/378128 "2025-05-14T10:12:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Linuxguru](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@Linuxguru](https://discuss.elastic.co/u/Linuxguru)\
**Post date:** [May 14, 2025, 10:12am UTC](https://discuss.elastic.co/t/sql-metrics-input-in-elastic-agent-not-returning-data-v8-14-3-postgresql-17-2/378128/1 "2025-05-14T10:12:29Z")

</div>

Hi,  
I'm using Elastic Agent in standalone mode (without Fleet) on RHEL 9, version 8.14.3. I aim to collect the max\_connections value from pg\_settings in PostgreSQL 17.2 and correlate it with the number of active connections from pg\_stat\_activity.

**Setup:**

- Elastic Agent: 8.14.3 (standalone mode)
- PostgreSQL: 17.2 (server and client)
- Elastic Stack: 8.14.3
- OS: RHEL 9

**Configuration:**

```auto
- type: sql/metrics
  id: sql-postgres-max-connections-my_app
  data_stream.namespace: my_app
  streams:
    - data_stream.dataset: sql.postgresql_custom
      driver: "postgres"
      hosts:
        - postgres://postgres@localhost:5432/?sslmode=disable
      metricsets:
        - query
      period: 1m
      result:
        format: table
      result_column_name: max_connections
      sql_query: >
        SELECT setting::int AS max_connections FROM pg_settings WHERE name = 'max_connections';

```

**Issue:**  
Despite the configuration, no data is ingested into Elasticsearch. The index `.ds-metrics-sql.postgresql_custom-*` is created, but documents only contain the SQL query string without any result fields.

**Troubleshooting Steps Taken:**

- Verified PostgreSQL connectivity and authentication.
- Executed the SQL query manually via `psql` successfully.
- Tried both `format: table` and `format: document` in the `result` section.
- Tested with a simple query: `SELECT 42 AS test_value;` — same issue.
- Enabled debug logging with `selectors: ["*"]` — no relevant errors or warnings.
- Checked the components directory: `postgresql` module is present, but no `sql` module found.
- Attempted to run the agent with `--dev` flag — not supported.

**Questions:**

1. Is the `sql/metrics` input officially supported in Elastic Agent 8.14.3 standalone mode?
2. Are there known issues or limitations with this input in the specified version?
3. Should the result of the SQL query appear directly in the `_source` of the document?
4. Is there an internal component or module required for `sql/metrics` that might be missing?
5. Would upgrading to Elastic Agent 8.15 or 9.0 resolve this issue, even if the Elastic Stack remains at 8.14.3?

Any insights or assistance would be greatly appreciated - thanks a lot in advance.
