summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2020-03-05 14:13:03 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-10 19:23:52 +0000
commit45eab9f82a18613b877598a951dc7b95f85f2059 (patch)
tree45ebe031ec8de64d98fd4fc44b9ad60f2b148211 /src/mongo
parent3848ef2467665a7c7756eb19b42cb0f523c03535 (diff)
downloadmongo-45eab9f82a18613b877598a951dc7b95f85f2059.tar.gz
SERVER-46585 Move redact to logv2
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/SConscript2
-rw-r--r--src/mongo/client/fetcher.cpp1
-rw-r--r--src/mongo/db/catalog/create_collection.cpp1
-rw-r--r--src/mongo/db/catalog/index_build_oplog_entry.cpp2
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp1
-rw-r--r--src/mongo/db/exec/working_set_common.cpp1
-rw-r--r--src/mongo/db/ops/write_ops_retryability.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_internal_shard_filter.cpp1
-rw-r--r--src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp2
-rw-r--r--src/mongo/db/query/query_planner_common.cpp2
-rw-r--r--src/mongo/db/repl/oplog_entry.cpp2
-rw-r--r--src/mongo/db/s/session_catalog_migration_destination.cpp2
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp1
-rw-r--r--src/mongo/db/transaction_history_iterator.cpp2
-rw-r--r--src/mongo/logger/SConscript1
-rw-r--r--src/mongo/logger/component_message_log_domain.cpp4
-rw-r--r--src/mongo/logger/component_message_log_domain.h12
-rw-r--r--src/mongo/logger/redaction.cpp2
-rw-r--r--src/mongo/logv2/SConscript1
-rw-r--r--src/mongo/logv2/log.h2
-rw-r--r--src/mongo/logv2/log_util.cpp11
-rw-r--r--src/mongo/logv2/log_util.h10
-rw-r--r--src/mongo/logv2/redaction.cpp90
-rw-r--r--src/mongo/logv2/redaction.h (renamed from src/mongo/logger/redaction.h)0
-rw-r--r--src/mongo/logv2/redaction_test.cpp (renamed from src/mongo/logger/redaction_test.cpp)25
-rw-r--r--src/mongo/s/request_types/move_chunk_request.cpp2
-rw-r--r--src/mongo/util/log.h1
27 files changed, 136 insertions, 47 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index fda0e482925..62ea415cdab 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -106,7 +106,6 @@ baseEnv.Library(
'logger/message_event_utf8_encoder.cpp',
'logger/message_log_domain.cpp',
'logger/ramlog.cpp',
- 'logger/redaction.cpp',
'logger/rotatable_file_manager.cpp',
'logger/rotatable_file_writer.cpp',
'logv2/attributes.cpp',
@@ -127,6 +126,7 @@ baseEnv.Library(
'logv2/plain_formatter.cpp',
'logv2/shared_access_fstream.cpp',
'logv2/ramlog.cpp',
+ 'logv2/redaction.cpp',
'logv2/text_formatter.cpp',
'platform/decimal128.cpp',
'platform/mutex.cpp',
diff --git a/src/mongo/client/fetcher.cpp b/src/mongo/client/fetcher.cpp
index 4fe470bf4f4..3c3ec5b2644 100644
--- a/src/mongo/client/fetcher.cpp
+++ b/src/mongo/client/fetcher.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp
index ebb298b22e4..f2f8d7b516b 100644
--- a/src/mongo/db/catalog/create_collection.cpp
+++ b/src/mongo/db/catalog/create_collection.cpp
@@ -47,7 +47,6 @@
#include "mongo/db/ops/insert.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/views/view_catalog.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log.h"
namespace mongo {
diff --git a/src/mongo/db/catalog/index_build_oplog_entry.cpp b/src/mongo/db/catalog/index_build_oplog_entry.cpp
index a89cd0ce6ea..b37d274be40 100644
--- a/src/mongo/db/catalog/index_build_oplog_entry.cpp
+++ b/src/mongo/db/catalog/index_build_oplog_entry.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/catalog/index_build_oplog_entry.h"
#include "mongo/bson/util/bson_extract.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/rpc/get_status_from_command_result.h"
namespace mongo {
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 7c2cf1c2d9c..f96bb31d426 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -53,7 +53,6 @@
#include "mongo/db/storage/durable_catalog.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/db/storage/write_unit_of_work.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/fail_point.h"
diff --git a/src/mongo/db/exec/working_set_common.cpp b/src/mongo/db/exec/working_set_common.cpp
index 3e2670ca7b4..f80d3a275e6 100644
--- a/src/mongo/db/exec/working_set_common.cpp
+++ b/src/mongo/db/exec/working_set_common.cpp
@@ -41,7 +41,6 @@
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/service_context.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log.h"
namespace mongo {
diff --git a/src/mongo/db/ops/write_ops_retryability.cpp b/src/mongo/db/ops/write_ops_retryability.cpp
index 866385c73fe..57e872fdb39 100644
--- a/src/mongo/db/ops/write_ops_retryability.cpp
+++ b/src/mongo/db/ops/write_ops_retryability.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/ops/find_and_modify_result.h"
#include "mongo/db/query/find_and_modify_request.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
namespace mongo {
namespace {
diff --git a/src/mongo/db/pipeline/document_source_internal_shard_filter.cpp b/src/mongo/db/pipeline/document_source_internal_shard_filter.cpp
index cb10a68d1c1..0c52aeaaefc 100644
--- a/src/mongo/db/pipeline/document_source_internal_shard_filter.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_shard_filter.cpp
@@ -34,7 +34,6 @@
#include "mongo/db/pipeline/document_source_internal_shard_filter.h"
#include "mongo/db/exec/document_value/document.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp b/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp
index 6622e0c9ab6..99e1fdd188f 100644
--- a/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/s/scoped_collection_metadata.h"
#include "mongo/executor/task_executor_pool.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/s/catalog_cache.h"
#include "mongo/s/cluster_commands_helpers.h"
#include "mongo/s/grid.h"
diff --git a/src/mongo/db/query/query_planner_common.cpp b/src/mongo/db/query/query_planner_common.cpp
index 34c62f1b1d0..78f9ca47311 100644
--- a/src/mongo/db/query/query_planner_common.cpp
+++ b/src/mongo/db/query/query_planner_common.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/query/projection_ast_path_tracking_visitor.h"
#include "mongo/db/query/projection_ast_walker.h"
#include "mongo/db/query/query_planner_common.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/repl/oplog_entry.cpp b/src/mongo/db/repl/oplog_entry.cpp
index 980630a3579..f1ff3aecd66 100644
--- a/src/mongo/db/repl/oplog_entry.cpp
+++ b/src/mongo/db/repl/oplog_entry.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/util/time_support.h"
namespace mongo {
diff --git a/src/mongo/db/s/session_catalog_migration_destination.cpp b/src/mongo/db/s/session_catalog_migration_destination.cpp
index 58f16e91711..2ae622b4e51 100644
--- a/src/mongo/db/s/session_catalog_migration_destination.cpp
+++ b/src/mongo/db/s/session_catalog_migration_destination.cpp
@@ -46,7 +46,7 @@
#include "mongo/db/session_catalog_mongod.h"
#include "mongo/db/transaction_participant.h"
#include "mongo/db/write_concern.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/s/shard_id.h"
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp
index 0057d138926..7025c6ba8ff 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -46,7 +46,6 @@
#include "mongo/db/s/sharding_config_optime_gossip.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/service_entry_point_common.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata/config_server_metadata.h"
diff --git a/src/mongo/db/transaction_history_iterator.cpp b/src/mongo/db/transaction_history_iterator.cpp
index ceca114d322..d3bff7fb807 100644
--- a/src/mongo/db/transaction_history_iterator.cpp
+++ b/src/mongo/db/transaction_history_iterator.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/repl/local_oplog_info.h"
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/transaction_history_iterator.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/util/str.h"
namespace mongo {
diff --git a/src/mongo/logger/SConscript b/src/mongo/logger/SConscript
index 7be4a25268f..6b8f3105227 100644
--- a/src/mongo/logger/SConscript
+++ b/src/mongo/logger/SConscript
@@ -30,7 +30,6 @@ env.CppUnitTest(
'log_function_test.cpp',
'log_test.cpp',
'parse_log_component_settings_test.cpp',
- 'redaction_test.cpp',
'rotatable_file_writer_test.cpp',
],
LIBDEPS=[
diff --git a/src/mongo/logger/component_message_log_domain.cpp b/src/mongo/logger/component_message_log_domain.cpp
index 19678733fb7..5715537cdbb 100644
--- a/src/mongo/logger/component_message_log_domain.cpp
+++ b/src/mongo/logger/component_message_log_domain.cpp
@@ -81,9 +81,5 @@ void ComponentMessageLogDomain::clearMinimumLoggedSeverity(LogComponent componen
_settings.clearMinimumLoggedSeverity(component);
}
-void ComponentMessageLogDomain::setShouldRedactLogs(bool shouldRedact) {
- _shouldRedact.store(shouldRedact);
-}
-
} // namespace logger
} // namespace mongo
diff --git a/src/mongo/logger/component_message_log_domain.h b/src/mongo/logger/component_message_log_domain.h
index 7cd2858090b..789ea2ebad8 100644
--- a/src/mongo/logger/component_message_log_domain.h
+++ b/src/mongo/logger/component_message_log_domain.h
@@ -82,18 +82,6 @@ public:
*/
void clearMinimumLoggedSeverity(LogComponent component);
- /**
- * Returns true if system logs should be redacted.
- */
- bool shouldRedactLogs() {
- return _shouldRedact.loadRelaxed();
- }
-
- /**
- * Set the 'redact' mode of the server.
- */
- void setShouldRedactLogs(bool shouldRedact);
-
private:
LogComponentSettings _settings;
AtomicWord<bool> _shouldRedact{false};
diff --git a/src/mongo/logger/redaction.cpp b/src/mongo/logger/redaction.cpp
index 5cf9c1b3ae7..0a34a10aa05 100644
--- a/src/mongo/logger/redaction.cpp
+++ b/src/mongo/logger/redaction.cpp
@@ -31,7 +31,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h"
diff --git a/src/mongo/logv2/SConscript b/src/mongo/logv2/SConscript
index 9772cb9c60b..6a723feea7f 100644
--- a/src/mongo/logv2/SConscript
+++ b/src/mongo/logv2/SConscript
@@ -8,6 +8,7 @@ env.CppUnitTest(
target='log_test_v2',
source=[
'log_test_v2.cpp',
+ 'redaction_test.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
diff --git a/src/mongo/logv2/log.h b/src/mongo/logv2/log.h
index 32efccd43c4..5c4a2c1ab7d 100644
--- a/src/mongo/logv2/log.h
+++ b/src/mongo/logv2/log.h
@@ -47,13 +47,13 @@
#include "mongo/base/status.h"
#include "mongo/bson/util/builder.h"
#include "mongo/logger/log_version_util.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logv2/log_component.h"
#include "mongo/logv2/log_component_settings.h"
#include "mongo/logv2/log_detail.h"
#include "mongo/logv2/log_domain.h"
#include "mongo/logv2/log_options.h"
#include "mongo/logv2/log_severity.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/util/errno_util.h"
#if defined(MONGO_LOG_DEFAULT_COMPONENT)
diff --git a/src/mongo/logv2/log_util.cpp b/src/mongo/logv2/log_util.cpp
index b30294e86a9..79f2abbd88a 100644
--- a/src/mongo/logv2/log_util.cpp
+++ b/src/mongo/logv2/log_util.cpp
@@ -41,6 +41,9 @@
#include <string>
namespace mongo::logv2 {
+namespace {
+AtomicWord<bool> redactionEnabled{false};
+}
bool rotateLogs(bool renameFiles) {
// Rotate on both logv1 and logv2 so all files that need rotation gets rotated
LOGV2(23166, "Log rotation initiated");
@@ -61,4 +64,12 @@ bool rotateLogs(bool renameFiles) {
}
return resultv2.isOK() && result.empty();
}
+
+bool shouldRedactLogs() {
+ return redactionEnabled.loadRelaxed();
+}
+
+void setShouldRedactLogs(bool enabled) {
+ redactionEnabled.store(enabled);
+}
} // namespace mongo::logv2
diff --git a/src/mongo/logv2/log_util.h b/src/mongo/logv2/log_util.h
index 195309cd0f0..c03d81f05f6 100644
--- a/src/mongo/logv2/log_util.h
+++ b/src/mongo/logv2/log_util.h
@@ -42,4 +42,14 @@ namespace mongo::logv2 {
* we do should result in a file create.
*/
bool rotateLogs(bool renameFiles);
+
+/**
+ * Returns true if system logs should be redacted.
+ */
+bool shouldRedactLogs();
+
+/**
+ * Set the 'redact' mode of the server.
+ */
+void setShouldRedactLogs(bool enabled);
} // namespace mongo::logv2
diff --git a/src/mongo/logv2/redaction.cpp b/src/mongo/logv2/redaction.cpp
new file mode 100644
index 00000000000..69758de7e04
--- /dev/null
+++ b/src/mongo/logv2/redaction.cpp
@@ -0,0 +1,90 @@
+/**
+ * Copyright (C) 2018-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/logv2/redaction.h"
+
+#include "mongo/base/status.h"
+#include "mongo/bson/bsonobj.h"
+#include "mongo/logv2/log_util.h"
+#include "mongo/util/assert_util.h"
+
+namespace mongo {
+
+namespace {
+
+constexpr auto kRedactionDefaultMask = "###"_sd;
+
+} // namespace
+
+BSONObj redact(const BSONObj& objectToRedact) {
+ if (!logv2::shouldRedactLogs()) {
+ return objectToRedact;
+ }
+
+ return objectToRedact.redact();
+}
+
+StringData redact(StringData stringToRedact) {
+ if (!logv2::shouldRedactLogs()) {
+ return stringToRedact;
+ }
+
+ // Return the default mask.
+ return kRedactionDefaultMask;
+}
+
+std::string redact(const Status& statusToRedact) {
+ if (!logv2::shouldRedactLogs()) {
+ return statusToRedact.toString();
+ }
+
+ // Construct a status representation without the reason()
+ StringBuilder sb;
+ sb << statusToRedact.codeString();
+ if (!statusToRedact.isOK())
+ sb << ": " << kRedactionDefaultMask;
+ return sb.str();
+}
+
+std::string redact(const DBException& exceptionToRedact) {
+ if (!logv2::shouldRedactLogs()) {
+ return exceptionToRedact.toString();
+ }
+
+ // Construct an exception representation with the what()
+ std::stringstream ss;
+ ss << exceptionToRedact.code() << " " << kRedactionDefaultMask;
+ return ss.str();
+}
+
+} // namespace mongo
diff --git a/src/mongo/logger/redaction.h b/src/mongo/logv2/redaction.h
index c1c67997ec1..c1c67997ec1 100644
--- a/src/mongo/logger/redaction.h
+++ b/src/mongo/logv2/redaction.h
diff --git a/src/mongo/logger/redaction_test.cpp b/src/mongo/logv2/redaction_test.cpp
index eb5902ec816..ca71e345ab5 100644
--- a/src/mongo/logger/redaction_test.cpp
+++ b/src/mongo/logv2/redaction_test.cpp
@@ -29,9 +29,10 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
#include "mongo/db/jsobj.h"
+#include "mongo/logv2/log_util.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/log.h"
@@ -43,7 +44,7 @@ const std::string kMsg = "Not initialized";
using BSONStringPair = std::pair<BSONObj, std::string>;
TEST(RedactStringTest, NoRedact) {
- logger::globalLogDomain()->setShouldRedactLogs(false);
+ logv2::setShouldRedactLogs(false);
std::string toRedact[] = {"", "abc", "*&$@!_\\\\\\\"*&$@!_\"*&$@!_\"*&$@!_"};
for (auto s : toRedact) {
@@ -52,7 +53,7 @@ TEST(RedactStringTest, NoRedact) {
}
TEST(RedactStringTest, BasicStrings) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
std::string toRedact[] = {"", "abc", "*&$@!_\\\\\\\"*&$@!_\"*&$@!_\"*&$@!_"};
for (auto s : toRedact) {
@@ -61,31 +62,31 @@ TEST(RedactStringTest, BasicStrings) {
}
TEST(RedactStatusTest, NoRedact) {
- logger::globalLogDomain()->setShouldRedactLogs(false);
+ logv2::setShouldRedactLogs(false);
Status status(ErrorCodes::InternalError, kMsg);
ASSERT_EQ(redact(status), status.toString());
}
TEST(RedactStatusTest, BasicStatus) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
Status status(ErrorCodes::InternalError, kMsg);
ASSERT_EQ(redact(status), "InternalError: " + kRedactionDefaultMask);
}
TEST(RedactStatusTest, StatusOK) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
ASSERT_EQ(redact(Status::OK()), "OK");
}
TEST(RedactExceptionTest, NoRedact) {
- logger::globalLogDomain()->setShouldRedactLogs(false);
+ logv2::setShouldRedactLogs(false);
ASSERT_THROWS_WITH_CHECK([] { uasserted(ErrorCodes::InternalError, kMsg); }(),
DBException,
[](const DBException& ex) { ASSERT_EQ(redact(ex), ex.toString()); });
}
TEST(RedactExceptionTest, BasicException) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
ASSERT_THROWS_WITH_CHECK(
[] { uasserted(ErrorCodes::InternalError, kMsg); }(),
DBException,
@@ -93,7 +94,7 @@ TEST(RedactExceptionTest, BasicException) {
}
TEST(RedactBSONTest, NoRedact) {
- logger::globalLogDomain()->setShouldRedactLogs(false);
+ logv2::setShouldRedactLogs(false);
BSONObj obj = BSON("a" << 1);
ASSERT_BSONOBJ_EQ(redact(obj), obj);
}
@@ -105,7 +106,7 @@ void testBSONCases(std::initializer_list<BSONStringPair> testCases) {
}
TEST(RedactBSONTest, BasicBSON) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
std::vector<BSONStringPair> testCases;
testBSONCases({BSONStringPair(BSONObj(), "{}"),
@@ -124,7 +125,7 @@ TEST(RedactBSONTest, BasicBSON) {
}
/*
TEST(RedactBSONTest, NestedBSON) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
std::vector<BSONStringPair> testCases;
testCases.push_back(BSONStringPair(BSON("a" << BSONObj()), "{ a: {} }"));
@@ -138,7 +139,7 @@ TEST(RedactBSONTest, NestedBSON) {
}
TEST(RedactBSONTest, BSONWithArrays) {
- logger::globalLogDomain()->setShouldRedactLogs(true);
+ logv2::setShouldRedactLogs(true);
std::vector<BSONStringPair> testCases;
testCases.push_back(BSONStringPair(BSON("a" << BSONArray()), "{ a: [] }"));
diff --git a/src/mongo/s/request_types/move_chunk_request.cpp b/src/mongo/s/request_types/move_chunk_request.cpp
index 4057eec0f32..02a8e196ca2 100644
--- a/src/mongo/s/request_types/move_chunk_request.cpp
+++ b/src/mongo/s/request_types/move_chunk_request.cpp
@@ -33,7 +33,7 @@
#include "mongo/base/status_with.h"
#include "mongo/bson/util/bson_extract.h"
-#include "mongo/logger/redaction.h"
+#include "mongo/logv2/redaction.h"
namespace mongo {
namespace {
diff --git a/src/mongo/util/log.h b/src/mongo/util/log.h
index 6346d615461..9dec9f07488 100644
--- a/src/mongo/util/log.h
+++ b/src/mongo/util/log.h
@@ -50,7 +50,6 @@
#include "mongo/logger/log_severity_limiter.h"
#include "mongo/logger/logger.h"
#include "mongo/logger/logstream_builder.h"
-#include "mongo/logger/redaction.h"
#include "mongo/logger/tee.h"
#include "mongo/logv2/log_component.h"
#include "mongo/logv2/log_component_settings.h"