{"id":10368,"date":"2023-09-05T19:52:42","date_gmt":"2023-09-06T00:52:42","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=10368"},"modified":"2023-09-06T12:19:40","modified_gmt":"2023-09-06T17:19:40","slug":"mongodb-increasing-log-level","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=10368","title":{"rendered":"MongoDB: Increasing Log Level"},"content":{"rendered":"<p>We had a problem with an application accessing our MongoDB cluster, and the log files didn&#8217;t provide much useful information. I could see the client connect and disconnect &#8230; but nothing in between. I discovered that the default logging level is <em>very<\/em> low. Good for disk utilization and I\/O, but not great for troubleshooting.<\/p>\n<pre>db.runCommand({getParameter: 1, logLevel: 1}) # Get the current logging level\r\ndb.setLogLevel(3) # Fairly robust logging\r\ndb.setLogLevel(5) # don't try this is prod huge stream of text super logging\r\ndb.setLogLevel(0) # and set logging back to a low level once you are done troubleshooting<\/pre>\n<p>You can also <a href=\"https:\/\/www.mongodb.com\/docs\/manual\/reference\/method\/db.setLogLevel\/\" target=\"_blank\" rel=\"noopener\">increase the log level for individual components of MongoDB<\/a> to minimize logging I\/O:<\/p>\n<pre>db.setLogLevel(2, \"accessControl\" )<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We had a problem with an application accessing our MongoDB cluster, and the log files didn&#8217;t provide much useful information. I could see the client connect and disconnect &#8230; but nothing in between. I discovered that the default logging level is very low. Good for disk utilization and I\/O, but not great for troubleshooting. db.runCommand({getParameter: &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1907],"tags":[429],"class_list":["post-10368","post","type-post","status-publish","format-standard","hentry","category-mongodb","tag-mongodb"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10368"}],"version-history":[{"count":3,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10368\/revisions"}],"predecessor-version":[{"id":10371,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10368\/revisions\/10371"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}