简体   繁体   中英

Log all Operations of MongoDB 3.6 on Windows 10

I want to see ALL queries which are processed by my local MongoDB instance.

I tried to set db.setProfilingLevel(2) but I still only get access information, but no queries.

Does anybody now how I can log EVERY query?

db.setProfilingLevel(2) causes the MongoDB profiler to collect data for all operations.

Perhaps you are expecting the profiler docs to turn up in the MongoDB server logs? If so, then bear in mind that the profiler output is written to the system.profile collection in whichever database profiling has been enabled.

More details in the docs but the short summary is:

// turn up the logging
db.setProfilingLevel(2)

// ... run some commands

// find all profiler documents, most recent first
db.system.profile.find().sort( { ts : -1 } )

// turn down the logging
db.setProfilingLevel(0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM