您好,登錄后才能下訂單哦!
這篇文章主要介紹“MongoDB的JSON格式日志是什么”,在日常操作中,相信很多人在MongoDB的JSON格式日志是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”MongoDB的JSON格式日志是什么”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
從4.4版本開始,MongoDB的mongo
和mongos
日志文件格式采用了JSON格式,更容易分析、解析。在此之前和其他日志文件格式一樣,純文本輸出。
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格式日志是什么”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。