Skip to content

Ensure the correct messages are sent to the database client

Description

The client_min_messages setting specifies the message levels that are sent to the database client (not the logs).

Each level includes all the levels that follow it.

Notice is generally accepted as the best practice for this setting.

Valid values are: - DEBUG5 - DEBUG4 - DEBUG3 - DEBUG2 - DEBUG1 - LOG - NOTICE - WARNING - ERROR - FATAL - PANIC

NOTE: LOG has a different rank here than in log_min_messages

Rationale

If this is not set correctly, the database client may receive too many messages or too few messages.

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 client_min_messages log level is set correctly
 */

function validate(databaseSettings, parameters = { client_min_messages : 'notice' }) {
    const supportedVersions = ['9.5']
    const supported = checkRdsVersion(databaseSettings, supportedVersions)
    if(!supported) {
        return OK_SKIP_VERSION
    }
    const settingName = 'client_min_messages'
    const expectedValue = parameters.client_min_messages
    const success = checkServerSetting(databaseSettings, settingName, expectedValue)
    return {
        success,
    }
}

// invoke
// TODO: add parameters
validate(databaseSettings);