Skip to content

Ensure 'log_truncate_on_rotation' is enabled


Enabling the log_truncate_on_rotation setting when logging_collector is enabled causes PostgreSQL to truncate (overwrite) existing log files with the same name during log rotation instead of appending to them.


If this setting is disabled, pre-existing log files will be appended to if log_filename is configured in such a way that static names are generated.

Applies To

  • Databases


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 } = module
 * @param {Object} databaseSettings - database settings object
 * @returns {boolean} true if the log_truncate_on_rotation option is enabled

function validate(databaseSettings) {
    const settingName = 'log_truncate_on_rotation'
    const expectedValue = 'on'
    const success = checkServerSetting(databaseSettings, settingName, expectedValue)
    return {

// invoke