Skip to content

Commit f054226

Browse files
committed
add audit
1 parent b47a53e commit f054226

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

api/v1/mongodbcommunity_types.go

+3
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ type AgentConfiguration struct {
373373
// LogRotate if enabled, will enable LogRotate for all processes.
374374
LogRotate *automationconfig.CrdLogRotate `json:"logRotate,omitempty"`
375375
// +optional
376+
// AuditLogRotate if enabled, will enable AuditLogRotate for all processes.
377+
AuditLogRotate *automationconfig.CrdLogRotate `json:"AuditLogRotate,omitempty"`
378+
// +optional
376379
// SystemLog configures system log of mongod
377380
SystemLog *automationconfig.SystemLog `json:"systemLog,omitempty"`
378381
}

controllers/replica_set_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func buildAutomationConfig(mdb mdbv1.MongoDBCommunity, auth automationconfig.Aut
535535
AddModifications(getMongodConfigModification(mdb)).
536536
AddModifications(modifications...).
537537
AddProcessModification(func(_ int, p *automationconfig.Process) {
538-
automationconfig.ConfigureAgentConfiguration(mdb.Spec.AgentConfiguration.SystemLog, mdb.Spec.AgentConfiguration.LogRotate, p)
538+
automationconfig.ConfigureAgentConfiguration(mdb.Spec.AgentConfiguration.SystemLog, mdb.Spec.AgentConfiguration.LogRotate, mdb.Spec.AgentConfiguration.AuditLogRotate, p)
539539
}).
540540
Build()
541541
}

pkg/automationconfig/automation_config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func FromBytes(acBytes []byte) (AutomationConfig, error) {
485485
return ac, nil
486486
}
487487

488-
func ConfigureAgentConfiguration(systemLog *SystemLog, logRotate *CrdLogRotate, p *Process) {
488+
func ConfigureAgentConfiguration(systemLog *SystemLog, logRotate *CrdLogRotate, auditLR *CrdLogRotate, p *Process) {
489489
if systemLog != nil {
490490
p.SetSystemLog(*systemLog)
491491
}
@@ -498,6 +498,7 @@ func ConfigureAgentConfiguration(systemLog *SystemLog, logRotate *CrdLogRotate,
498498
zap.S().Warn("Configuring LogRotate with systemLog.Destination = Syslog will not work")
499499
}
500500
p.SetLogRotate(logRotate)
501+
p.SetAuditLogRotate(auditLR)
501502
}
502503

503504
}

0 commit comments

Comments
 (0)