liveBook · Manning

Log

As explained in MongoDB 8.0 in Action, Third Edition

Logging is the systematic recording of system activities, user actions, and application events for later review and analysis.

Logging records system activity, user actions, and application events so you can investigate problems, review performance, and detect security issues. section 21.3

MongoDB and Atlas logs cover different parts of database operations:

  • Database logs record events such as slow queries, connections, and system activity; Atlas retains them for 30 days. section 21.3.2
  • Audit logs record activities such as authentication attempts and data access when database auditing is enabled. section 21.3.2
  • Trigger logs cover events involving triggers, functions, and change streams; Atlas retains them for 10 days. section 21.3.2
atlas logs download <hostname> <log-type> [flags].

Use the Atlas CLI download command to retrieve a log for a specific host; find project hostnames with atlas process list. Downloadable logs are unavailable for M0 free and Flex shared clusters. section 21.3.2

mongosh session logs

mongosh stores session logs in ~/.mongodb/mongosh/<LogID>_log. It keeps up to 100 log files for 30 days; from version 1.0.5, the logging format aligns with the MongoDB server format, and credentials are redacted. section 3.2.4

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Details log categories, retention, access, and filtering, but does not specify a full analysis procedure.
Examples
Shows database, audit, trigger, and mongosh logs, plus Atlas CLI downloads and mongosh log paths.
What you can do after
Diagnose database problems and investigate performance bottlenecks or potential security issues by reviewing logs.
How it connects
Connects logging with database auditing, slow queries, Performance Advisor, and Query Profiler.

Also explained in

Compare how 14 books explain log →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.