fluentd - fluentd mongo_tail 不会将集合记录到标准输出
问题描述
我需要使用 fluentd 来跟踪 mongodb 中的集合并发送到 s3 存储桶,第一步是跟踪集合并将其记录到标准输出,这是我坚持的步骤。
2021-04-01 14:29:46 +0000 [info]: gem 'fluent-plugin-mongo' version '1.5.0'
2021-04-01 14:29:46 +0000 [info]: gem 'fluentd' version '1.12.0'
2021-04-01 14:29:46 +0000 [info]: gem 'fluentd' version '0.12.43'
2021-04-01 14:29:47 +0000 [warn]: define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead
2021-04-01 14:29:47 +0000 [info]: using configuration file: <ROOT>
<source>
@type mongo_tail
tag_key "tag"
tag "app.mongo_log"
wait_time 1
mongo_log_level "error"
time_key "time"
collection "transcripts"
url "mongodb://user:***@mongo-db:27017/dev/?authSource=admin&replicaSet=rs0&readPreference=secondaryPreferred"
object_id_keys ["id_key"]
</source>
<source>
@type http
port 9880
</source>
<match **>
@type stdout
</match>
</ROOT>
2021-04-01 14:29:47 +0000 [info]: starting fluentd-1.12.0 pid=7 ruby="2.5.8"
2021-04-01 14:29:47 +0000 [info]: spawn command to main: cmdline=["/usr/bin/ruby", "-Eascii-8bit:ascii-8bit", "/usr/bin/fluentd", "-c", "/fluentd/etc/fluentd.conf", "-p", "/fluentd/plugins", "--under-supervisor"]
2021-04-01 14:29:49 +0000 [info]: adding match pattern="**" type="stdout"
2021-04-01 14:29:49 +0000 [info]: adding source type="mongo_tail"
2021-04-01 14:29:50 +0000 [info]: adding source type="http"
2021-04-01 14:29:51 +0000 [warn]: #0 define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead
2021-04-01 14:29:51 +0000 [info]: #0 starting fluentd worker pid=20 ppid=7 worker=0
2021-04-01 14:29:51.058081458 +0000 fluent.info: {"pid":20,"ppid":7,"worker":0,"message":"starting fluentd worker pid=20 ppid=7 worker=0"}
2021-04-01 14:29:51 +0000 [info]: #0 fluentd worker is now running worker=0
2021-04-01 14:29:51.379805402 +0000 fluent.info: {"worker":0,"message":"fluentd worker is now running worker=0"}
解决方案
推荐阅读
- sql - Rails 与扩展生成不正确 SQL 的多对多关系
- codeigniter - 将 codeigniter 项目从本地主机移动到实时服务器
- scala - Scala动态类到内部动态类
- python - 使用 python 抓取推文的问题
- python-3.x - 亚当优化器和梯度下降
- c - 在vs代码中在哪里添加-g标志进行调试
- javascript - 使用 Subject 和 Observable 有什么区别,各自的用途是什么?
- javascript - 关于使用 React styled-components 对类组件进行样式设置
- php - Magento 迁移后显示旧网站
- javascript - JavaScript 在预定时间倒计时