Skip to content

Ensure 'log_executor_stats' is disabled

Description

Enabling the log_executor_stats setting causes executor performance statistics to be written to the server log.

This is a crude profiling instrument, similar to the Unix getrusage() operating system facility. This module reports per-module statistics. The executor performance statistics logging is disabled (off) by default and should only be enabled if directed to do so by your organization's logging policy.

Rationale

The logging of these additional statistics when not mandated by your organization's logging policy greatly reduces the signal-to-noise ratio of the PostgreSQL logs.

Applies To

  • Databases

Tags

This rule is applied when the following tags are present:

Tag With Value
secureclouddb/provider aws
secureclouddb/service rds
secureclouddb/engine postgres

Default Rule

const { checkServerSetting, checkRdsVersion, OK_SKIP_VERSION } = module

/**
 * @param {Object} databaseSettings - database settings object
 * @returns {boolean} true if the log_executor_stats option is off
 */

function validate(databaseSettings) {
    const supportedVersions = ['9.5']
    const supported = checkRdsVersion(databaseSettings, supportedVersions)
    if(!supported) {
        return OK_SKIP_VERSION
    }
    const settingName = 'log_executor_stats'
    const expectedValue = 'off'
    const success = checkServerSetting(databaseSettings, settingName, expectedValue)
    return {
        success,
    }
}

// invoke
validate(databaseSettings);