MongoDB的JSON格式日志是什么

这篇文章主要介绍“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说明:

  • Timestamp:时间戳,日志事件发生的时间

  • Serverity:日志信息等级

  • F:Fatal

  • E:Error

  • W:Warning

  • I:Information

  • D1-D5:Debug级别,从4.2开始支持指定Debug级别。

  • Compontents:日志事件的分类

  • ACCESS:登入访问相关的信息,例如登录验证情况。

  • COMMAND:数据库执行命令相关信息,例如,查询。

  • CONTROL:记录控制管理相关的信息,例如数据库初始化。

  • ELECTION:副本集选举相关信息

  • FTDC:(full-time diagnostic data ) 全程检测数据信息,例如Server的状态统计信息。3.2新增

  • GEO:解析地理空间模型相关信息。

  • INDEX:索引相关信息,例如索引的创建过程信息。

  • INITSYNC:初始化同步操作相关信息

  • JOURNAL:日志相关的信息

  • NETWORK:网络相关信息,例如网络连接信息。

  • QUERY:查询相关信息,例如查询计划信息。

  • REPL:副本集相关信息,包括:初始化同步,心疼,状态,回滚等信息,包括ELECTION,INITSYSNC,REPL_HB和ROLLBACK。

  • REPL_HB:副本集心跳相关信息

  • ROLLBACK:回滚操作相关信息

  • SHARDING:分片相关信息,例如mongos的启动信息

  • STORAGE:存储相关信息,例如将 storage 层的数据刷入磁盘的信息。

  • TXN:多文档事务相关信息,4.0.2新增

  • RECOVERY:还原活动相关的信息

  • WRITE:写操作相关的信息,例如更新(update)的命令。

  • Context:产生该日志事件的线程名称

  • id:日志语句的独一无二的编号

  • Message:日志事件详细信息

  • Attributes:(可选)附件信息,也就是发生该日志事件时的相关对象属性,例如:操作系统版本,端口号,pid进程号等。

  • Tags:标签

  • Truncated :日志截断信息

  • Size:发生日志截断时,之前的日志文件大小。

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

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

评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论电报频道链接