在 k8s 集群上,我将 fluentd 作为 Daemonset 运行,并使用 tail 插件从命名空间收集容器日志并将其发送到弹性集群......非常标准的设置。
<source>
@type tail
path /var/log/containers/*_default_*.log, /var/log/containers/*_test-namespace_*.log
pos_file /var/log/ns-containers.log.pos
read_lines_limit 100
tag test.*
<parse>
@type json
time_key time
time_format %Y-%m-%dT%H:%M:%S.%N%z
keep_time_key true
</parse>
refresh_interval 30s
</source>
但是,我注意到并非所有作为 k8s 作业的 cronjobs 的一部分创建的日志最终都在弹性搜索集群中。