首页 > 解决方案 > 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"}

标签: fluentd

解决方案


推荐阅读