MongoDB - logging write and read requests

We are trying to write read and write operations in MongoDB. We want the actual requests to be logged in the file. We use the following configuration (basically node in the replica set):

logpath=/.../mongodb.log
logappend=true
profile=2
slowms=1
diaglog=3
verbose=true
vvvv=true

As far as I understand, this should work. However, in the log we can only see the type of request (drop / insert / update, etc.) and the collection, and not the actual request that was executed.

EDIT: To clarify: we want to register read and write requests in the regular mongodb log file (as in MySQL, for example).

What could be the problem? Does anyone have any ideas? Thank!

+3
source share
2 answers

First of all, pay attention:

, .

, mongo. slowms=1 profile=2 , .

:

db.setProfilingLevel(2)
db.testProf.insert({x : 1})
db.testProf.update({x : 1}, {$set : {x : 2}})
db.testProf.find({x : 2})
db.testProf.remove({x : 2})
db.setProfilingLevel(0)

:

db.system.profile.find().pretty()

, . :

"op" : "update",
    "ns" : "profDb.testProf",
    "query" : {
            "x" : 1
    },
    "updateobj" : {
            "$set" : {
                    "x" : 2
            }
    },
    "nscanned" : 1,
    "nupdated" : 1,
    "fastmod" : true,
    "keyUpdates" : 0,
    "numYield" : 0,
    "lockStats" : {
            "timeLockedMicros" : {
                    "r" : NumberLong(0),
                    "w" : NumberLong(1131)
            },
            "timeAcquiringMicros" : {
                    "r" : NumberLong(0),
                    "w" : NumberLong(5)
            }
    }

query , updateobj , . , query - , , , .. .

, , . -

EDIT: diaglog=3. . , , , . .

EDIT: , , , , . . , , :

mongoexport --db profDb --collection system.profile --out profiler.json

, diaglog , , .

diaglog .

, !

+2

, :

db.setProfilingLevel(2)

.

: http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/

EDIT: , db.system.profile.

0

All Articles