How to Collect MongoDB Information and Logs
3 min
This article outlines steps on how to collect the necessary MongoDB information and logs. This collection is needed by Engineering and MongoDB Support in order to better understand the issue and begin their analysis.
The following items are the most often needed and usually help troubleshoot 90% of issues:
- mongod logs files from all members
- dbPath/diagnostic.data folder content. This contains MongoDB internal metrics, which help in diagnosing i/o, cache, journal, and other issues.
Weβll use a script to capture the aforementioned items along with additional information to assist with the troubleshooting.
Turbine Platform Installer (TPI)
- Download the collect-mongo-logs-tpi.sh script available at the bottom of this page.
- For Standalone, the MongoDB PRIMARY member will always be swimlane-sw-mongo-0. If this is HA, then let's start by looking up the MongoDB PRIMARY member. Youβll need this information when running the script.
export NS=<SWIMLANE-NAMESPACE>
kubectl -n $NS exec mongo-0 -- mongosh -u Admin -p --authenticationDatabase admin --tls --tlsAllowInvalidHostnames --tlsAllowInvalidCertificates admin --eval="rs.isMaster().primary;"
- Execute the file
chmod u+x collect-mongo-logs-tpi.sh
collect-mongo-logs-tpi.sh | tee collect-mongo-logs-tpi-results.log
- Update the Support ticket with the following information:
- Upload the resulting /tmp/mongo.logs.####.tar.gz file to our secure portal
- Timeframe information of the incident
- Is this issue recurring?
- Is there any workload-driven pattern?