'How to write log file for individual collection in mongodb database?
I have a peculiar question that I haven't been able to find an answer to yet. I have a database and a collection in it. Let's call them "test database" and "test collection". There are a range of users from root to a user with read-only access to the "test database". I need to output a special log file for operations that are carried out in a "test database".
I have already found "mongo.log" in the path "/var/log/mongodb/". But all possible requests from all "databases" are loaded into this file at once, which is not convenient. Is it possible somehow to create a separate file for writing logs only from the "test database"?
I also found out earlier that in order to keep track of all requests, I need to set the following settings:
$ mongo
MongoDB shell version: 2.4.9
connecting to: test
> use myDb
switched to db myDb
> db.getProfilingLevel()
0
> db.setProfilingLevel(2)
{ "was" : 0, "slowms" : 1, "ok" : 1 }
> db.getProfilingLevel()
2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
