针对Fluent-Bit采集容器日志的补充
hello,之前我寫過《一套標準的ASP.NET Core容器化應用日志收集分析方案》,在公司團隊、微信公眾號、Github上反映良好。
其中配置Fluent-bit使用Forward協議收集容器日志,需要在Docker-Compose App配置Loging Driver=Fluentd
實踐中,存在一個小遺憾:應用了Logging Driver= Fluentd的容器,不再能直觀看到容器日志。
作為一個小有技術潔癖的碼農,勢必要深究一下原因。
群里某大佬,給到官方資料:
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升級到20.10+版本...... 解決這個小遺憾。
插曲:
選擇Docker 20+版本時,請輸入上圖的:后面字符串所指示的版本:
yum install docker-ce-20.10.2 docker-ce-cli-20.10.2 containerd.io
經實測(升級Docker版本),配置了Logging Driver= Fluentd的容器,現在可直觀看到容器日志。
That‘s All,?以上是對《一套標準的ASP.NET Core容器化應用日志收集分析方案》的補充,應該對同學們有所幫助!~。。~
Ref
一套標準的ASP.NET Core容器化應用日志收集分析方案
https://docs.docker.com/config/containers/logging/configure/
https://docs.docker.com/config/containers/logging/dual-logging/
總結
以上是生活随笔為你收集整理的针对Fluent-Bit采集容器日志的补充的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: docker安装jenkins并用doc
- 下一篇: 如何在 C# 8 中使用默认接口方法