[MM-65587] Remove unused audit log file rotation settings (#35170)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Ben Schumacher 2026-03-04 07:54:17 -05:00 committed by GitHub
parent 72460bff61
commit a9a3d3f889
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 4 additions and 207 deletions

View file

@ -175,11 +175,6 @@
"ExperimentalAuditSettings": {
"FileEnabled": false,
"FileName": "",
"FileMaxSizeMB": 100,
"FileMaxAgeDays": 0,
"FileMaxBackups": 0,
"FileCompress": false,
"FileMaxQueueSize": 1000,
"AdvancedLoggingJSON": {}
},
"PasswordSettings": {

View file

@ -281,11 +281,6 @@ const defaultServerConfig: AdminConfig = {
ExperimentalAuditSettings: {
FileEnabled: false,
FileName: '',
FileMaxSizeMB: 100,
FileMaxAgeDays: 0,
FileMaxBackups: 0,
FileCompress: false,
FileMaxQueueSize: 1000,
AdvancedLoggingJSON: {},
Certificate: '',
},

View file

@ -18,13 +18,8 @@ import (
func TestMloggerConfigFromAuditConfig(t *testing.T) {
auditSettings := model.ExperimentalAuditSettings{
FileEnabled: model.NewPointer(true),
FileName: model.NewPointer("audit.log"),
FileMaxSizeMB: model.NewPointer(20),
FileMaxAgeDays: model.NewPointer(1),
FileMaxBackups: model.NewPointer(5),
FileCompress: model.NewPointer(true),
FileMaxQueueSize: model.NewPointer(5000),
FileEnabled: model.NewPointer(true),
FileName: model.NewPointer("audit.log"),
}
t.Run("validate default audit settings", func(t *testing.T) {

View file

@ -10192,22 +10192,6 @@
"id": "model.config.is_valid.encrypt_sql.app_error",
"translation": "Invalid at rest encrypt key for SQL settings. Must be 32 chars or more."
},
{
"id": "model.config.is_valid.experimental_audit_settings.file_max_age_invalid",
"translation": "Max File Age of audit logs config must not be negative."
},
{
"id": "model.config.is_valid.experimental_audit_settings.file_max_backups_invalid",
"translation": "Maximum File Backups of audit logs config must not be negative."
},
{
"id": "model.config.is_valid.experimental_audit_settings.file_max_queue_size_invalid",
"translation": "Maximum File Queue of audit logs config must be greater than zero."
},
{
"id": "model.config.is_valid.experimental_audit_settings.file_max_size_invalid",
"translation": "Maximum File Size of audit logs config must be greater than zero."
},
{
"id": "model.config.is_valid.experimental_audit_settings.file_name_empty",
"translation": "When audit file logging is enabled, a file name must be specified."

View file

@ -1661,11 +1661,6 @@ func (s *LogSettings) GetAdvancedLoggingConfig() []byte {
type ExperimentalAuditSettings struct {
FileEnabled *bool `access:"experimental_features,write_restrictable,cloud_restrictable"`
FileName *string `access:"experimental_features,write_restrictable,cloud_restrictable"` // telemetry: none
FileMaxSizeMB *int `access:"experimental_features,write_restrictable,cloud_restrictable"`
FileMaxAgeDays *int `access:"experimental_features,write_restrictable,cloud_restrictable"`
FileMaxBackups *int `access:"experimental_features,write_restrictable,cloud_restrictable"`
FileCompress *bool `access:"experimental_features,write_restrictable,cloud_restrictable"`
FileMaxQueueSize *int `access:"experimental_features,write_restrictable,cloud_restrictable"`
AdvancedLoggingJSON json.RawMessage `access:"experimental_features"`
Certificate *string `access:"experimental_features"` // telemetry: none
}
@ -1679,22 +1674,6 @@ func (s *ExperimentalAuditSettings) isValid() *AppError {
if strings.HasSuffix(*s.FileName, `\`) {
return NewAppError("ExperimentalAuditSettings.isValid", "model.config.is_valid.experimental_audit_settings.file_name_is_directory", nil, "", http.StatusBadRequest)
}
if *s.FileMaxSizeMB <= 0 {
return NewAppError("ExperimentalAuditSettings.isValid", "model.config.is_valid.experimental_audit_settings.file_max_size_invalid", nil, "", http.StatusBadRequest)
}
if *s.FileMaxAgeDays < 0 {
return NewAppError("ExperimentalAuditSettings.isValid", "model.config.is_valid.experimental_audit_settings.file_max_age_invalid", nil, "", http.StatusBadRequest)
}
if *s.FileMaxBackups < 0 {
return NewAppError("ExperimentalAuditSettings.isValid", "model.config.is_valid.experimental_audit_settings.file_max_backups_invalid", nil, "", http.StatusBadRequest)
}
if *s.FileMaxQueueSize <= 0 {
return NewAppError("ExperimentalAuditSettings.isValid", "model.config.is_valid.experimental_audit_settings.file_max_queue_size_invalid", nil, "", http.StatusBadRequest)
}
}
cfg := make(mlog.LoggerConfiguration)
@ -1720,26 +1699,6 @@ func (s *ExperimentalAuditSettings) SetDefaults() {
s.FileName = NewPointer("")
}
if s.FileMaxSizeMB == nil {
s.FileMaxSizeMB = NewPointer(100)
}
if s.FileMaxAgeDays == nil {
s.FileMaxAgeDays = NewPointer(0) // no limit on age
}
if s.FileMaxBackups == nil { // no limit on number of backups
s.FileMaxBackups = NewPointer(0)
}
if s.FileCompress == nil {
s.FileCompress = NewPointer(false)
}
if s.FileMaxQueueSize == nil {
s.FileMaxQueueSize = NewPointer(1000)
}
if utils.IsEmptyJSON(s.AdvancedLoggingJSON) {
s.AdvancedLoggingJSON = []byte("{}")
}

View file

@ -2395,72 +2395,11 @@ func TestExperimentalAuditSettingsIsValid(t *testing.T) {
},
"file enabled with valid filename": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(100),
FileMaxAgeDays: NewPointer(5),
FileMaxBackups: NewPointer(10),
FileMaxQueueSize: NewPointer(1000),
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
},
ExpectError: false,
},
"invalid file max size": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(0),
},
ExpectError: true,
},
"negative file max size": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(-10),
},
ExpectError: true,
},
"negative file max age": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(100),
FileMaxAgeDays: NewPointer(-5),
},
ExpectError: true,
},
"negative file max backups": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(100),
FileMaxAgeDays: NewPointer(5),
FileMaxBackups: NewPointer(-10),
},
ExpectError: true,
},
"zero file max queue size": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(100),
FileMaxAgeDays: NewPointer(5),
FileMaxBackups: NewPointer(10),
FileMaxQueueSize: NewPointer(0),
},
ExpectError: true,
},
"negative file max queue size": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
FileEnabled: NewPointer(true),
FileName: NewPointer("audit.log"),
FileMaxSizeMB: NewPointer(100),
FileMaxAgeDays: NewPointer(5),
FileMaxBackups: NewPointer(10),
FileMaxQueueSize: NewPointer(-1000),
},
ExpectError: true,
},
"AdvancedLoggingJSON has JSON error ": {
ExperimentalAuditSettings: ExperimentalAuditSettings{
AdvancedLoggingJSON: json.RawMessage(`

View file

@ -5856,61 +5856,6 @@ const AdminDefinition: AdminDefinitionType = {
),
isHidden: it.licensedForFeature('Cloud'),
},
{
type: 'number',
key: 'ExperimentalAuditSettings.FileMaxSizeMB',
label: defineMessage({id: 'admin.audit_logging_experimental.file_max_size.title', defaultMessage: 'Max File Size (MB)'}),
help_text: defineMessage({id: 'admin.audit_logging_experimental.file_max_size.help_text', defaultMessage: 'Maximum size, in megabytes (MB), the log file can grow before it gets rotated.'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
it.stateIsFalse('ExperimentalAuditSettings.FileEnabled'),
),
isHidden: it.licensedForFeature('Cloud'),
},
{
type: 'number',
key: 'ExperimentalAuditSettings.FileMaxAgeDays',
label: defineMessage({id: 'admin.audit_logging_experimental.file_max_age.title', defaultMessage: 'Max File Age (Days)'}),
help_text: defineMessage({id: 'admin.audit_logging_experimental.file_max_age.help_text', defaultMessage: 'Maximum number of days to retain old log files. 0 disables the removal of old log files.'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
it.stateIsFalse('ExperimentalAuditSettings.FileEnabled'),
),
isHidden: it.licensedForFeature('Cloud'),
},
{
type: 'number',
key: 'ExperimentalAuditSettings.FileMaxBackups',
label: defineMessage({id: 'admin.audit_logging_experimental.file_max_backups.title', defaultMessage: 'Maximum File Backups'}),
help_text: defineMessage({id: 'admin.audit_logging_experimental.file_max_backups.help_text', defaultMessage: 'Maximum number of old log files to retain. 0 retains all old log files. Note: Configuring Max File Age can result in old log files being deleted regardless of this configuration value.'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
it.stateIsFalse('ExperimentalAuditSettings.FileEnabled'),
),
isHidden: it.licensedForFeature('Cloud'),
},
{
type: 'bool',
key: 'ExperimentalAuditSettings.FileCompress',
label: defineMessage({id: 'admin.audit_logging_experimental.file_compress.title', defaultMessage: 'File Compression'}),
help_text: defineMessage({id: 'admin.audit_logging_experimental.file_compress.help_text', defaultMessage: 'Choose whether enable or disable file compression.'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
it.stateIsFalse('ExperimentalAuditSettings.FileEnabled'),
),
isHidden: it.licensedForFeature('Cloud'),
},
{
type: 'number',
key: 'ExperimentalAuditSettings.FileMaxQueueSize',
label: defineMessage({id: 'admin.audit_logging_experimental.file_max_queue_size.title', defaultMessage: 'Maximum File Queue'}),
help_text: defineMessage({id: 'admin.audit_logging_experimental.file_max_queue_size.help_text', defaultMessage: 'The maximum number of files to be retained in the queue.'}),
isDisabled: it.any(
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
it.stateIsFalse('ExperimentalAuditSettings.FileEnabled'),
),
isHidden: it.licensedForFeature('Cloud'),
},
{
type: 'longtext',
key: 'ExperimentalAuditSettings.AdvancedLoggingJSON',

View file

@ -374,18 +374,8 @@
"admin.audit_logging_experimental.certificate.title": "Certificate",
"admin.audit_logging_experimental.certificate.tooltip": "A previous update is still in progress. Please wait.",
"admin.audit_logging_experimental.certificate.uploading": "Uploading Certificate...",
"admin.audit_logging_experimental.file_compress.help_text": "Choose whether enable or disable file compression.",
"admin.audit_logging_experimental.file_compress.title": "File Compression",
"admin.audit_logging_experimental.file_enabled.help_text": "Choose whether audit logs are written locally to a file or not.",
"admin.audit_logging_experimental.file_enabled.title": "File Enabled",
"admin.audit_logging_experimental.file_max_age.help_text": "Maximum number of days to retain old log files. 0 disables the removal of old log files.",
"admin.audit_logging_experimental.file_max_age.title": "Max File Age (Days)",
"admin.audit_logging_experimental.file_max_backups.help_text": "Maximum number of old log files to retain. 0 retains all old log files. Note: Configuring Max File Age can result in old log files being deleted regardless of this configuration value.",
"admin.audit_logging_experimental.file_max_backups.title": "Maximum File Backups",
"admin.audit_logging_experimental.file_max_queue_size.help_text": "The maximum number of files to be retained in the queue.",
"admin.audit_logging_experimental.file_max_queue_size.title": "Maximum File Queue",
"admin.audit_logging_experimental.file_max_size.help_text": "Maximum size, in megabytes (MB), the log file can grow before it gets rotated.",
"admin.audit_logging_experimental.file_max_size.title": "Max File Size (MB)",
"admin.audit_logging_experimental.file_name.help_text": "The name of the file to write to.",
"admin.audit_logging_experimental.file_name.title": "File Name",
"admin.auditlogging.title": "Audit Logging",

View file

@ -509,11 +509,6 @@ export type LogSettings = {
export type ExperimentalAuditSettings = {
FileEnabled: boolean;
FileName: string;
FileMaxSizeMB: number;
FileMaxAgeDays: number;
FileMaxBackups: number;
FileCompress: boolean;
FileMaxQueueSize: number;
AdvancedLoggingJSON: Record<string, any>;
Certificate: string;
};