国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 幫助中心 > 正文

docker日志出現無法檢索問題的解決

2024-07-09 22:43:00
字體:
來源:轉載
供稿:網友

日常檢查服務的時候,從portainer那里進去看容器日志的時候,發現右上角出現紅色的感嘆號:Unable to retrieve container logs。

因為之前沒出現過這樣的問題,所以就先上服務器上用命令docker logs -f containerID看日志,發現日志也是動不了,還是停留在某個時間的日志記錄上。

想了一下不應該是服務的日志打印出問題,先照著Google搜索了一遍,發現都沒有跟我的問題相匹配的。因為日志有時能收集顯示,有些日志不可以,應該是跟docker設置的日志引擎有問題。

本來是想整一套EFK的,但是感覺現在日志量還不夠大,所以并沒有修改docker的日志引擎,還是默認的journald

[root@ad-official xiaoxiao]# docker info|grep Logging WARNING: You're not using the default seccomp profileLogging Driver: journald

journald的官方文檔上有這么一個說明:

man journald.conf ... RateLimitInterval=, RateLimitBurst= Configures the rate limiting that is applied to all messages generated on the system. If, in the time interval defined by RateLimitInterval=, more messages than specified in RateLimitBurst= are logged by a service, all further messages within the interval are dropped until the interval is over. A message about the number of dropped messages is generated. This rate limiting is applied per-service, so that two services which log do not interfere with each other's limits. Defaults to 1000 messages in 30s. The time specification for RateLimitInterval= may be specified in the following units: "s", "min", "h", "ms", "us". To turn off any kind of rate limiting, set either value to 0. ...

這里寫了默認30秒內只能接收1000條日志,看到這里就能明白了,因為前陣子剛在docker發布了一個單日日志文件大小差不多達到3G的服務,導致到了其他服務的日志也受到了影響,大量的日志被journald丟棄,所以我們修改一下配置就沒有問題了。

打開/etc/systemd/journald.conf文件,將RateLimitBurst從默認的1000修改成5000,根據自己目前的日志輸出量進行調整:

[root@ad-official log]# cat /etc/systemd/journald.conf# This file is part of systemd.## systemd is free software; you can redistribute it and/or modify it# under the terms of the GNU Lesser General Public License as published by# the Free Software Foundation; either version 2.1 of the License, or# (at your option) any later version.## Entries in this file show the compile time defaults.# You can change settings by editing this file.# Defaults can be restored by simply deleting this file.## See journald.conf(5) for details.[Journal]#Storage=auto#Compress=yes#Seal=yes#SplitMode=uid#SyncIntervalSec=5m#RateLimitInterval=30sRateLimitBurst=5000#SystemMaxUse=#SystemKeepFree=#SystemMaxFileSize=#RuntimeMaxUse=#RuntimeKeepFree=#RuntimeMaxFileSize=#MaxRetentionSec=#MaxFileSec=1monthForwardToSyslog=no#ForwardToKMsg=no#ForwardToConsole=noForwardToWall=no#TTYPath=/dev/console#MaxLevelStore=debug#MaxLevelSyslog=debug#MaxLevelKMsg=notice#MaxLevelConsole=info#MaxLevelWall=emerg#LineMax=48K

順便將ForwardToSyslog和ForwardToWall設置成no,因為默認是yes,會導致我們清理了journal的日志文件,而Syslog中的沒有清除掉,慢慢的就會將磁盤占滿。

上一篇:pytorch之inception

下一篇:pytorch之inception

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 华蓥市| 秦皇岛市| 广德县| 什邡市| 布尔津县| 扎赉特旗| 崇仁县| 宕昌县| 分宜县| 璧山县| 和静县| 阿鲁科尔沁旗| 博爱县| 寿宁县| 峨眉山市| 米易县| 张家口市| 兴城市| 开鲁县| 万山特区| 阿图什市| 高邮市| 延边| 赣州市| 西乌珠穆沁旗| 汉寿县| 天气| 新乐市| 孙吴县| 上饶县| 休宁县| 祁东县| 郑州市| 凤凰县| 蕉岭县| 磴口县| 德庆县| 息烽县| 独山县| 灵川县| 昌邑市|