PostgreSQL database 'log_temp_files' flag isn’t set to '0'

ID

gcp_postgresql_logging_temp_files_disabled

Severity

low

Vendor

GCP

Resource

AIM

Tags

non-reachable

Description

The log_temp_files parameter is a configuration option for PostgreSQL databases that allows logging information about temporary files that are created for actions such as sorting, hashing and temporary query results.

This can help with identifying potential performance issues that can be caused by poor programming practices or deliberate resource starvation attempts.

To fix it, should enable log_temp_files flag on your Cloud SQL instance by setting it to 0 (zero).

Learn more about this topic at PgPedia.

Examples

---
- name: sql_instance
  google.cloud.gcp_sql_instance:
    auth_kind: serviceaccount
    database_version: SQLSERVER_13_1
    name: "{{ resource_name }}-2"
    project: test_project
    region: us-central1
    service_account_file: /tmp/auth.pem
    settings:
      database_flags:
        - name: log_temp_files
          value: 1
      tier: db-n1-standard-1
    state: present

Mitigation / Fix

---
- name: sql_instance
  google.cloud.gcp_sql_instance:
    auth_kind: serviceaccount
    database_version: SQLSERVER_13_1
    name: '{{ resource_name }}-2'
    project: test_project
    region: us-central1
    service_account_file: /tmp/auth.pem
    settings:
      database_flags:
        - name: log_temp_files
          value: 0
      tier: db-n1-standard-1
    state: present