I'm trying to understand how I can disable mongodb warning messages about the deprecated usage of ssl. I did add the --quiet flag in my connection string, but it doesn't seem to help.
Just for context - I'm writing a bash script that interacts with the database, perhaps there's a way to direct the output to a file or something? A newbie here so please excuse me about it :)
{"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"}}
CodePudding user response:
In your bash, any command output can be filtered, modified, sent to a file, ...
Illustration:
#!/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/'
You can adapt any of these methods to your command output.