How can I prevent MongoDB from logging the contents of queries under any circumstance? I'm working with sensitive data in MongoDB (Community Server, v3.2, upgrading to latest in the near future). On the production server, it's essential that the data is not written to the log under any circumstances. This is because the log files are processed on a system which is not authorised to contain sensitive data.

The problem is that the sensitive data is often being mentioned explicitly in queries and aggregations etc. This means any kind of query logging needs to be disabled. I still want to retain basic informational logging so that system critical events can be monitored.

What I've done so far is:


Set all log levels to 0.
Set slow query timeout threshold to a very high value.


Is there anything else I need to do to ensure the sensitive data never gets logged? In particular, is it possible to disable slow query logging entirely, instead of relying on a high threshold?
Yes,with 3.4 Enterprise version it is possible. Log Redaction.