Error fetching data for metricset postgresql.activity: error in QueryStats: failed to obtain a connection with the database: pq: SSL is not enabled on the server","service.name":"metricbeat","ecs.version":"1.6.0"}

Dear Team,

I'm encountering SSL errors when trying to connect Metricbeat to my PostgreSQL database. Here are the details:

  • Error Message:
    {"log.level":"error","@timestamp":"2023-10-13T11:45:38.996Z","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset postgresql.database: error in QueryStats: failed to obtain a connection with the database: pq: SSL is not enabled on the server","service.name":"metricbeat","ecs.version":"1.6.0"}
    {"log.level":"error","@timestamp":"2023-10-13T11:45:38.996Z","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset postgresql.bgwriter: error in QueryStats: failed to obtain a connection with the database: pq: SSL is not enabled on the server","service.name":"metricbeat","ecs.version":"1.6.0"}
    {"log.level":"error","@timestamp":"2023-10-13T11:45:38.996Z","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset postgresql.activity: error in QueryStats: failed to obtain a connection with the database: pq: SSL is not enabled on the server","service.name":"metricbeat","ecs.version":"1.6.0"}
    {"log.level":"error","@timestamp":"2023-10-13T11:45:38.996Z","log.origin":{"file.name":"module/wrapper.go","file.line":256},"message":"Error fetching data for metricset postgresql.statement: QueryStats: failed to obtain a connection with the database: pq: SSL is not enabled on the server","service.name":"metricbeat","ecs.version":"1.6.0"}

  • Environment:

    • OS: Linux
    • Metricbeat Version: 8.10.3
    • PostgreSQL Version: 13.4
    • Custom Configurations: (mention any custom settings)
  • postgresql.yml Configuration:

  • module: postgresql
    enabled: true
    metricsets:

    • database
    • bgwriter
    • activity
    • statement
      period: 10s
      hosts: ["postgres://metricbeatuser:metricbeatuser@localhost:5432/postgres"]
  • Steps Taken:

    • I have reviewed my configuration, and I ran "metricbeat test config," which returned a successful result.
  • Questions:

    • Is my SSL configuration in the Metricbeat configuration file correct?
    • Are there any known issues with Metricbeat and PostgreSQL SSL connections?
  • Postgresql SSL is off

  • Expectations:

    • I expected Metricbeat to connect to PostgreSQL over SSL without errors.
  • Contact Information:

Thank you for your assistance.

Could you please try as following

postgres://metricbeatuser:metricbeatuser@localhost:5432/postgres?sslmode=disable

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.