suppress verbose MongoDB INFO logs in docker

- Add all logging components with verbosity 0 in mongod.conf
- Add WiredTiger verbose=[] to suppress checkpoint messages
- Add --quiet flag to mongod command
- Change healthcheck from mongosh to TCP port check to avoid
  connection metadata spam every 30s
- Increase healthcheck interval from 30s to 60s

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael 2025-12-22 11:26:44 -06:00
parent 91a2894911
commit 22e1744f25
2 changed files with 30 additions and 5 deletions

View file

@ -1,4 +1,7 @@
# MongoDB Configuration for Minimal Logging
# Note: MongoDB INFO messages cannot be fully suppressed via config.
# This config minimizes logging as much as possible.
systemLog:
verbosity: 0
quiet: true
@ -9,18 +12,39 @@ systemLog:
verbosity: 0
control:
verbosity: 0
ftdc:
verbosity: 0
geo:
verbosity: 0
index:
verbosity: 0
network:
verbosity: 0
query:
verbosity: 0
replication:
verbosity: 0
recovery:
verbosity: 0
sharding:
verbosity: 0
storage:
verbosity: 0
journal:
verbosity: 0
wt:
verbosity: 0
transaction:
verbosity: 0
write:
verbosity: 0
# Suppress verbose checkpoint messages
net:
maxIncomingConnections: 100
# Suppress verbose messages
setParameter:
logLevel: 0
diagnosticDataCollectionEnabled: false
# Suppress WiredTiger verbose checkpoint messages
wiredTigerEngineRuntimeConfig: "verbose=[]"

View file

@ -18,7 +18,7 @@ services:
image: mongo:7.0
container_name: accessible-video-mongodb
restart: unless-stopped
command: ["mongod", "--config", "/etc/mongod.conf"]
command: ["mongod", "--config", "/etc/mongod.conf", "--quiet"]
environment:
MONGO_INITDB_DATABASE: ${MONGODB_DB:-accessible_video}
volumes:
@ -28,11 +28,12 @@ services:
networks:
- accessible-video-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 30s
# TCP port check avoids mongosh connection metadata spam in logs
test: ["CMD-SHELL", "timeout 5 bash -c '</dev/tcp/localhost/27017' || exit 1"]
interval: 60s
timeout: 10s
retries: 3
start_period: 10s
start_period: 15s
logging:
driver: "json-file"
options: