针对Fluent-Bit采集容器日志的补充
hello,之前我寫(xiě)過(guò)《一套標(biāo)準(zhǔn)的ASP.NET Core容器化應(yīng)用日志收集分析方案》,在公司團(tuán)隊(duì)、微信公眾號(hào)、Github上反映良好。
其中配置Fluent-bit使用Forward協(xié)議收集容器日志,需要在Docker-Compose App配置Loging Driver=Fluentd
實(shí)踐中,存在一個(gè)小遺憾:應(yīng)用了Logging Driver= Fluentd的容器,不再能直觀看到容器日志。
作為一個(gè)小有技術(shù)潔癖的碼農(nóng),勢(shì)必要深究一下原因。
群里某大佬,給到官方資料:
Note
When using Docker Engine 19.03 or older, the docker logs command is only functional for the local, json-file and journald logging drivers. Docker 20.10 and up introduces “dual logging”, which uses a local buffer that allows you to use the docker logs command for any logging driver. Refer to reading logs when using remote logging drivers for details.
大意:19.03及之前版本的Docker,docker log命令僅僅作用在local、json-file、journald類型的logging Driver。
但是Docker 20.10版本引入了dual logging(提供本地緩存), 這樣可以在任意logging Driver上使用docker log指令。
Todo
So, 將Docker升級(jí)到20.10+版本...... 解決這個(gè)小遺憾。
插曲:
選擇Docker 20+版本時(shí),請(qǐng)輸入上圖的:后面字符串所指示的版本:
yum install docker-ce-20.10.2 docker-ce-cli-20.10.2 containerd.io
經(jīng)實(shí)測(cè)(升級(jí)Docker版本),配置了Logging Driver= Fluentd的容器,現(xiàn)在可直觀看到容器日志。
That‘s All,?以上是對(duì)《一套標(biāo)準(zhǔn)的ASP.NET Core容器化應(yīng)用日志收集分析方案》的補(bǔ)充,應(yīng)該對(duì)同學(xué)們有所幫助!~。。~
Ref
一套標(biāo)準(zhǔn)的ASP.NET Core容器化應(yīng)用日志收集分析方案
https://docs.docker.com/config/containers/logging/configure/
https://docs.docker.com/config/containers/logging/dual-logging/
總結(jié)
以上是生活随笔為你收集整理的针对Fluent-Bit采集容器日志的补充的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: docker安装jenkins并用doc
- 下一篇: 【Vscode】调试DotNet Cor