HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Can slowms be set on each individual database in MongoDB?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canindividualeachslowmsmongodbdatabaseset

Problem

I am using db.setProfilingLevel(1, 1000) to set the profile level for each database. I see the level can be set for each database but the slowms is a global state. Is there any way to set this value for each individual database?

If I can't set it for each individual database, why there is a method db.setProfilingLevel(level, slowms) accept the second parameter as slowms. It looks like this parameter is for global value rather than database value. What is confused is this method is specific for setting a single database profile level but for some reasons it also set slowms in global setting.

Solution

setProfilingLevel actually affects two things. First parameter (level) tells when system writes to profile -collection (0-never, 1-only when slower than slowms or 2-always). Second parameter (slowms) affects actually always to syslog output of ALL databases. So, with db.setProfilingLevel(0,-1), nothing is ever written to profile-collection, but ALL queries (of all DBs) are written to mongod.log

Context

StackExchange Database Administrators Q#203566, answer score: 2

Revisions (0)

No revisions yet.