ugotchi
ugotchi

Reputation: 1013

MongoDB not logging to log file

I'm using MongoDB on OSX, with mongod confirmed running. I checked the mongod.conf file and the following is present and unmodified:

systemLog:
  destination: file
  path: /usr/local/var/log/mongodb/mongo.log
  logAppend: true

So far so good. The path location exists, however the folder is empty - no mongo.log. This was a standard installation and everything has been fine so far except this. Any idea on how to troubleshoot this issue?

Upvotes: 5

Views: 12215

Answers (1)

Benjamin
Benjamin

Reputation: 1862

Context

I deleted my mongod.log file once. Then I recreated it and ran into this exact problem. I may have deleted the /var/log/mongodb folder as well, then recreated it.

I was reading under Run Mongodb Community Edition:

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

The MongoDB instance stores its data files in /var/lib/mongodb and its log files in /var/log/mongodb by default, and runs using the mongodb user account.

I read into this way too much and assumed the user who starts the mongodb service is the "mongodb user account". This is incorrect. They literally mean the user: mongodb

Solution

sudo chown mongodb /var/log/mongodb

Upvotes: 9

Related Questions