gpt4 book ai didi

mongodb - 来自 mongod 4.4 命令的不可读终端日志

转载 作者:行者123 更新时间:2023-12-04 18:43:24 25 4
gpt4 key购买 nike

我正在使用 tmux作为我的默认终端。
以下是终端日志,输入命令 sudo mongod

{"t":{"$date":"2021-01-28T18:10:29.521+05:30"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-01-28T18:10:29.523+05:30"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-01-28T18:10:29.523+05:30"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-01-28T18:10:29.524+05:30"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":27636,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"khaldrogo-HP-Notebook"}}
{"t":{"$date":"2021-01-28T18:10:29.524+05:30"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.3","gitVersion":"913d6b62acfbb344dde1b116f4161360acd8fd13","openSSLVersion":"OpenSSL 1.1.1f 31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-01-28T18:10:29.524+05:30"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2021-01-28T18:10:29.524+05:30"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2021-01-28T18:10:29.547+05:30"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db","storageEngine":"wiredTiger"}}
{"t":{"$date":"2021-01-28T18:10:29.547+05:30"},"s":"I", "c":"STORAGE", "id":22297, "ctx":"initandlisten","msg":"Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem","tags":["startupWarnings"]}
{"t":{"$date":"2021-01-28T18:10:29.547+05:30"},"s":"I", "c":"STORAGE", "id":22315, "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=1413M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
...continued
如何获得正确的输出格式?

最佳答案

蒙哥推荐jq工具。
此过滤器将生成类似于旧样式​​的输出:

jq -c '.t["$date"] + " " + .s + " " + .c + " [" + .ctx + "] " + .msg' /var/log/mongo/mongo.log
仅过滤警告和(致命)错误可能很有用:
select( .s == "W" or .s =="E" or .s =="F" ) | .t["$date"] + " " + .s + " " + .c + " [" + .ctx + "] " + .msg

"2021-01-28T18:10:29.523+05:30 W ASIO [main] No TransportLayer configured during NetworkInterface startup"
或试试这个:
select( .s | contains("W","E","F") ) | .t["$date"] + " -> " + .c + " " + .msg + "\n   attr: " + (.attr | tostring) + "\n   tags: " + (.tags|tostring)
jq play

关于mongodb - 来自 mongod 4.4 命令的不可读终端日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65937402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com