Skip to content

Ensure 'log_checkpoints' is enabled

Description

Enabling the log_checkpoints setting causes checkpoints and restartpoints to be logged in the server log.

Some statistics are included in the log messages, including the number of buffers written and the time spent writing them.

Rationale

Enabling the logging of checkpoints is the easiest method of tracking both the frequency and duration of the checkpoint operations.

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 { checkRdsVersion, checkServerSetting, OK_SKIP_VERSION } = module

/**
 * @param {Object} databaseSettings - database settings object
 * @returns {boolean} true if the checkpoints logging is enabled
 */
function validate(databaseSettings) {

    const supportedVersions = ['9.5']
    const supported = checkRdsVersion(databaseSettings, supportedVersions)
    if(!supported) {
        return OK_SKIP_VERSION
    }

    const settingName = 'log_checkpoints'
    const expectedValue = 'on'
    const success = checkServerSetting(databaseSettings, settingName, expectedValue)

    return {
        success,
    }
}

// invoke
validate(databaseSettings);