Restrict Metricbeats Postgresql module logging to single database

9/26/2019

Using this Helm chart to log Postgres with great results https://github.com/elastic/helm-charts/tree/master/metricbeat

Unfortunately, it's logging all of our databases instead of just production. Can someone recommend how to restrict it to a single database? I suspect that I if I restricted the user's access to DB's from PSQL, it would just show me error messages instead of actually restricting it.

values.yaml for Helm below:

metricbeatConfig:
  metricbeat.yml: |
    system:
      hostfs: /hostfs
    reload.enabled: true
    metricbeat.modules:
    - module: postgresql
      enabled: true
      metricsets:
        - database
      hosts: ['postgres://USER:PW@AWS.rds.amazonaws.com:5432/DATABASE_NAME']
    output.elasticsearch:
      hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
-- EntaroAdun
elasticsearch
kibana
kubernetes-helm
postgresql

1 Answer

9/26/2019

From the documentation it states that configuring the postgresql database metricset collect "stats about every PostgreSQL database".

One option would be to drop events based on their host/hostname in the events, only allowing the desired DB stats through. see https://www.elastic.co/guide/en/beats/metricbeat/current/drop-event.html

-- Opster Elasticsearch Support
Source: StackOverflow