人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

docker日志出現(xiàn)無法檢索問題的解決

發(fā)布日期:2022-02-14 10:37 | 文章來源:站長之家

日常檢查服務(wù)的時(shí)候,從portainer那里進(jìn)去看容器日志的時(shí)候,發(fā)現(xiàn)右上角出現(xiàn)紅色的感嘆號:Unable to retrieve container logs。

因?yàn)橹皼]出現(xiàn)過這樣的問題,所以就先上服務(wù)器上用命令docker logs -f containerID看日志,發(fā)現(xiàn)日志也是動不了,還是停留在某個(gè)時(shí)間的日志記錄上。

想了一下不應(yīng)該是服務(wù)的日志打印出問題,先照著Google搜索了一遍,發(fā)現(xiàn)都沒有跟我的問題相匹配的。因?yàn)槿罩居袝r(shí)能收集顯示,有些日志不可以,應(yīng)該是跟docker設(shè)置的日志引擎有問題。

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

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

journald的官方文檔上有這么一個(gè)說明:

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. ...

這里寫了默認(rèn)30秒內(nèi)只能接收1000條日志,看到這里就能明白了,因?yàn)榍瓣囎觿傇赿ocker發(fā)布了一個(gè)單日日志文件大小差不多達(dá)到3G的服務(wù),導(dǎo)致到了其他服務(wù)的日志也受到了影響,大量的日志被journald丟棄,所以我們修改一下配置就沒有問題了。

打開/etc/systemd/journald.conf文件,將RateLimitBurst從默認(rèn)的1000修改成5000,根據(jù)自己目前的日志輸出量進(jìn)行調(diào)整:

[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=30s
RateLimitBurst=5000
#SystemMaxUse=
#SystemKeepFree=
#SystemMaxFileSize=
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#MaxRetentionSec=
#MaxFileSec=1month
ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
ForwardToWall=no
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K

順便將ForwardToSyslog和ForwardToWall設(shè)置成no,因?yàn)槟J(rèn)是yes,會導(dǎo)致我們清理了journal的日志文件,而Syslog中的沒有清除掉,慢慢的就會將磁盤占滿。

然后重啟一下journald就可以恢復(fù)正常使用啦:systemctl restart systemd-journald.service

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持本站。

香港快速服務(wù)器

版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

實(shí)時(shí)開通

自選配置、實(shí)時(shí)開通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問服務(wù)

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部