如何抑制 mongo 中已弃用的 ssl 消息输出?
How to suppress deprecated ssl message output from mongo?
我正在尝试了解如何禁用有关已弃用 ssl 的 mongodb 警告消息。
我确实在我的连接字符串中添加了 --quiet 标志,但它似乎没有帮助。
仅供参考 - 我正在编写一个与数据库交互的 bash 脚本,也许有一种方法可以将输出定向到文件或其他内容?
这里是新手所以请原谅:)
{"t":{"$date":"2022-05-12T10:58:02.347Z"},"s":"W", "c":"CONTROL", "id":12123, "ctx":"main","msg":"Option: This name is deprecated. Please use the preferred name instead.","attr":{"deprecatedName":"ssl","preferredName":"tls"}}
{"t":{"$date":"2022-05-12T10:58:02.347Z"},"s":"W", "c":"CONTROL", "id":12123, "ctx":"main","msg":"Option: This name is deprecated. Please use the preferred name instead.","attr":{"deprecatedName":"sslPEMKeyFile","preferredName":"tlsCertificateKeyFile"}}
{"t":{"$date":"2022-05-12T10:58:02.347Z"},"s":"W", "c":"CONTROL", "id":12123, "ctx":"main","msg":"Option: This name is deprecated. Please use the preferred name instead.","attr":{"deprecatedName":"sslCAFile","preferredName":"tlsCAFile"}}
在您的 bash 中,任何命令输出都可以被过滤、修改、发送到文件,...
插图:
#!/bin/bash
# Eliminate all output
/bin/ls -c1 /etc >/dev/null
# Filter the output, remove all files containing the word "host"
/bin/ls -c1 /etc | grep -v host
# Send to a file
/bin/ls -c1 /etc >output_file
# Send to a file and see the messages on your terminal
/bin/ls -c1 /etc | tee output_file
# Hide only the error messages
/bin/ls -c1 /etc 2>/dev/null
# Send all output AND errors to a file
/bin/ls -c1 /etc >output_file 2>output_file
# Same as above, other syntax
/bin/ls -c1 /etc >output_file 2>&1
# Modify the output. Here if the filename contains "host", replace it by "AAAA"
/bin/ls -c1 /etc | sed 's/host/AAAA/'
您可以将这些方法中的任何一种应用到您的命令输出中。
我正在尝试了解如何禁用有关已弃用 ssl 的 mongodb 警告消息。 我确实在我的连接字符串中添加了 --quiet 标志,但它似乎没有帮助。
仅供参考 - 我正在编写一个与数据库交互的 bash 脚本,也许有一种方法可以将输出定向到文件或其他内容? 这里是新手所以请原谅:)
{"t":{"$date":"2022-05-12T10:58:02.347Z"},"s":"W", "c":"CONTROL", "id":12123, "ctx":"main","msg":"Option: This name is deprecated. Please use the preferred name instead.","attr":{"deprecatedName":"ssl","preferredName":"tls"}}
{"t":{"$date":"2022-05-12T10:58:02.347Z"},"s":"W", "c":"CONTROL", "id":12123, "ctx":"main","msg":"Option: This name is deprecated. Please use the preferred name instead.","attr":{"deprecatedName":"sslPEMKeyFile","preferredName":"tlsCertificateKeyFile"}}
{"t":{"$date":"2022-05-12T10:58:02.347Z"},"s":"W", "c":"CONTROL", "id":12123, "ctx":"main","msg":"Option: This name is deprecated. Please use the preferred name instead.","attr":{"deprecatedName":"sslCAFile","preferredName":"tlsCAFile"}}
在您的 bash 中,任何命令输出都可以被过滤、修改、发送到文件,...
插图:
#!/bin/bash
# Eliminate all output
/bin/ls -c1 /etc >/dev/null
# Filter the output, remove all files containing the word "host"
/bin/ls -c1 /etc | grep -v host
# Send to a file
/bin/ls -c1 /etc >output_file
# Send to a file and see the messages on your terminal
/bin/ls -c1 /etc | tee output_file
# Hide only the error messages
/bin/ls -c1 /etc 2>/dev/null
# Send all output AND errors to a file
/bin/ls -c1 /etc >output_file 2>output_file
# Same as above, other syntax
/bin/ls -c1 /etc >output_file 2>&1
# Modify the output. Here if the filename contains "host", replace it by "AAAA"
/bin/ls -c1 /etc | sed 's/host/AAAA/'
您可以将这些方法中的任何一种应用到您的命令输出中。