PostgreSQL database instance should have a 'log_checkpoints' flag with its value set to 'on'

ID

gcp_postgresql_log_checkpoints_flag_not_set_on

Severity

low

Vendor

GCP

Resource

Observability

Tags

reachable

Description

The log_checkpoints flag is a PostgreSQL database flag that allows checkpoints and restart points to be logged and included within the PostgreSQL server log.

This logging data can be used to identify and troubleshoot sub-optimal PostgreSQL database performance. By default, this flag is disabled for Google Cloud PostgreSQL instances.

To fix it, you must configure the flag log_checkpoints at settings.database_flags with a on value.

Learn more about this topic at View instance logs.

Examples

---
- name: create instance
  google.cloud.gcp_sql_instance:
    name: GCP instance
    settings:
      databaseFlags:
      - name: log_checkpoints
        value: off
      tier: db-n1-standard-1
    region: us-central1
    project: test_project
    database_version: POSTGRES_9_6
    auth_kind: serviceaccount
    service_account_file: "/tmp/auth.pem"
    state: present

Mitigation / Fix

---
- name: create a instance
  google.cloud.gcp_sql_instance:
    name: GCP instance
    settings:
      databaseFlags:
      - name: log_checkpoints
        value: on
      tier: db-n1-standard-1
    region: us-central1
    project: test_project
    database_version: POSTGRES_9_6
    auth_kind: serviceaccount
    service_account_file: /tmp/auth.pem
    state: present