MongoDB的JSON格式日志是什么

发布时间:2022-10-21 14:52:50 作者:iii
来源:亿速云 阅读:247

这篇文章主要介绍“MongoDB的JSON格式日志是什么”,在日常操作中,相信很多人在MongoDB的JSON格式日志是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”MongoDB的JSON格式日志是什么”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

从4.4版本开始,MongoDB的mongomongos日志文件格式采用了JSON格式,更容易分析、解析。在此之前和其他日志文件格式一样,纯文本输出。

4.4日志格式

JSON格式更清晰,也更细分析、解析,非常方便。

{"t":{"$date":"2020-08-31T16:23:50.984+08:00"},"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":"2020-08-31T16:23:50.987+08:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-08-31T16:23:50.987+08:00"},"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":"2020-08-31T16:23:50.988+08:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":5836,"port":27017,"dbPath"
:"/usr/local/mongo4.4.0/data/db","architecture":"64-bit","host":"lei"}}
{"t":{"$date":"2020-08-31T16:23:50.988+08:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVer
sion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","openSSLVersion":"OpenSSL 1.0.1e-fips 11 Feb 2013","modules":[],"allocator":"tcmalloc","environment":{"distmod":"rhel70","dis
tarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-08-31T16:23:50.988+08:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"CentOS Linux relea
se 7.5.1804 (Core) ","version":"Kernel 3.10.0-862.el7.x86_64"}}}
{"t":{"$date":"2020-08-31T16:23:50.988+08:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"
/etc/mongo.conf","net":{"bindIp":"0.0.0.0","maxIncomingConnections":100,"port":27017},"processManagement":{"fork":true},"security":{"authorization":"enabled"},"storage":{"dbP
ath":"/usr/local/mongo4.4.0/data/db","engine":"wiredTiger","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":true,"path":"/usr/local/mongo4.4.0/logs/m
ongodb.log"}}}}
{"t":{"$date":"2020-08-31T16:23:50.989+08:00"},"s":"E",  "c":"STORAGE",  "id":20557,   "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error"
:"NonExistentPath: Data directory /usr/local/mongo4.4.0/data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or
 (2) by adding the 'storage.dbPath' option in the configuration file."}}
{"t":{"$date":"2020-08-31T16:23:50.989+08:00"},"s":"I",  "c":"NETWORK",  "id":20562,   "ctx":"initandlisten","msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2020-08-31T16:23:50.989+08:00"},"s":"I",  "c":"-",        "id":20520,   "ctx":"initandlisten","msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2020-08-31T16:23:50.989+08:00"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2020-08-31T16:23:50.989+08:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":100}}

KEY缩写:

{
  "t": <Datetime>, // timestamp
  "s": <String>, // severity
  "c": <String>, // component
  "ctx": <String>, // context
  "id": <String>, // unique identifier
  "msg": <String>, // message body
  "attr": <Object> // additional attributes (optional)
  "tags": <Array of strings> // tags (optional)
  "truncated": <Object> // truncation info (if truncated)
  "size": <Integer> // original size of entry (if truncated)
}

KEY说明:

到此,关于“MongoDB的JSON格式日志是什么”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

推荐阅读:
  1. MongoDB慢日志查询
  2. mongodb日志切割

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mongodb json

上一篇:JSON解析插入到PG数据库时报错\u000怎么解决

下一篇:C语言定义和使用的特殊标准是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》