Docs Menu
Docs Home
/
MongoDB Enterprise Kubernetes Operator
/

MongoDB CRD Log Rotation Settings

On this page

  • MongoDB Log Rotation
  • Application Database Log Rotation

You can configure most log rotation settings for CustomResourceDefinitions in the MongoDB and Ops Manager CRD manifests.

The following table outlines logging configuration fields that you can define in the MongoDB CRD manifests, and where they can be defined or accessed elsewhere if they can't be defined directly in the CRD manifests.

Component
Log type
Configuration location
MongoDB
Automation agent logs
MongoDB
Monitoring Agent logs
Ops Manager API or UI
MongoDB
Backup logs
Ops Manager API or UI
MongoDB
MongoDB logs
Ops Manager UI
MongoDB
Audit logs
Ops Manager UI
MongoDB
Readiness Probe
Application Database
MongoDB Logs
Application Database
Automation Agent Logs
Application Database
Monitoring Agent logs
Forwarded to stdout only (kubectl logs). Managed and stored in the Kubernetes control plane.
Application Database
Audit logs

You can configure a log's rotation in the MongoDB CRD, as shown in the following example manifest. See the preceding table for more information about configuring the rotation of other MongoDB-specific logs.

You can configure the MongoDB automation agent logs in the MongoDB CRD manifest under spec.agent.startupOptions.

apiVersion: mongodb.com/v1
kind: MongoDB
metadata:
name: log-rotate
namespace: mongodb
spec:
podSpec:
podTemplate:
spec:
containers:
- name: mongodb-enterprise-database
env:
- name: READINESS_PROBE_LOGGER_MAX_SIZE
value: "50"
version: 6.0.0-ent
opsManager:
configMapRef:
name: my-project
credentials: my-credentials
type: Standalone
persistent: false
# https://docs.opsmanager.mongodb.com/current/reference/mongodb-agent-settings/
agent:
startupOptions:
maxLogFiles: "4"
maxLogFileDurationHrs: "1"
maxUncompressedLogFiles: "2"

You can configure the following log's rotation in the MongoDBOpsManager CRD, as shown in the following example manifest. See the preceding table for more information about configuring the rotation of other Application Database-specific logs.

You can configure the Application Database MongoDB log rotation in the MongoDBOpsManager manifest under spec.applicationDatabase.agent.logRotate. MongoDB compresses log files beyond the two most recent logs by default.

Logs:
  • /var/log/mongodb-mms-automation/mongodb.log

You can configure the Application Database Automation Agent log rotation in the MongoDBOpsManager manifest under spec.applicationDatabase.agent.startupOptions.

Logs:
  • /var/log/mongodb-mms-automation/automation-agent-stderr.log

  • /var/log/mongodb-mms-automation/automation-agent-verbose.log

  • /var/log/mongodb-mms-automation/automation-agent.log

You can configure the Application Database Audit log rotation in the MongoDBOpsManager manifest under spec.applicationDatabase.agent.logRotate.includeAuditLogsWithMongoDBLogs.

Logs:
  • /var/log/mongodb-mms-automation/mongodb-audit.log

apiVersion: mongodb.com/v1
kind: MongoDBOpsManager
metadata:
name: ops-manager
namespace: mongodb
spec:
replicas: 1
version: 6.0.19
adminCredentials: ops-manager-admin-secret
applicationDatabase:
version: "6.0.11-ent"
members: 3
agent:
#AppDB (mongod) log rotation
logRotate:
numTotal: 4
numUncompressed: 2
timeThresholdHrs: 1
sizeThresholdMB: "10"
#Automation Agent log rotation
startupOptions:
maxLogFiles: "4"
maxLogFileDurationHrs: "1"
maxUncompressedLogFiles: "2"

Back

Support Lifestyle