fluent/fluent-plugin-mongo

Error: init is specified, but there're parameters without default values:@type (ArgumentError)

Malayke opened this issue · 0 comments

docker run --rm -it -e  'FLUENTD_CONF=docker.conf' fluentd                
2022-07-13 06:10:31 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/docker.conf"
2022-07-13 06:10:31 +0000 [info]: gem 'fluent-plugin-mongo' version '1.5.0'
2022-07-13 06:10:31 +0000 [info]: gem 'fluentd' version '1.14.6'
Traceback (most recent call last):
        26: from /usr/bin/fluentd:23:in `<main>'
        25: from /usr/bin/fluentd:23:in `load'
        24: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/bin/fluentd:15:in `<top (required)>'
        23: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
        22: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
        21: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/command/fluentd.rb:356:in `<top (required)>'
        20: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/supervisor.rb:668:in `run_supervisor'
        19: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/engine.rb:80:in `run_configure'
        18: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/engine.rb:105:in `configure'
        17: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/root_agent.rb:149:in `configure'
        16: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/agent.rb:64:in `configure'
        15: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/agent.rb:64:in `each'
        14: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/agent.rb:72:in `block in configure'
        13: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/agent.rb:154:in `add_filter'
        12: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin.rb:187:in `configure'
        11: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin/filter_parser.rb:51:in `configure'
        10: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin_helper/parser.rb:83:in `configure'
         9: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin/filter.rb:53:in `configure'
         8: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin_helper/event_emitter.rb:80:in `configure'
         7: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin_helper/metrics.rb:40:in `configure'
         6: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/log.rb:657:in `configure'
         5: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin_id.rb:44:in `configure'
         4: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/plugin/base.rb:63:in `configure'
         3: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/configurable.rb:94:in `configure'
         2: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/config/section.rb:215:in `generate'
         1: from /usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/config/section.rb:215:in `each'
/usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.6/lib/fluent/config/section.rb:224:in `block in generate': parse: init is specified, but there're parameters without default values:@type (ArgumentError)

docker.conf content

<source>
  @type forward
  port 24224
  bind 0.0.0.0
</source>

<filter docker.**>
  @type parser
  key_name log
  reserve_data true
</filter>

# Single MongoDB
<match docker.**>
  @type mongo
  connection_string mongodb://docker:docker@mongo:27017/docker?authSource=admin&ssl=false
  host mongo
  port 27017
  # authentication
  user docker
  password docker

  database docker
  collection logs

  # for capped collection
  capped
  capped_size 1024m



  <inject>
    # key name of timestamp
    time_key time
  </inject>

  <buffer>
    # flush
    flush_interval 10s
  </buffer>
</match>

Dockerfile content

FROM fluent/fluentd:v1.14-1

# Use root account to use apk
USER root

# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN apk add --no-cache --update --virtual .build-deps \
        sudo build-base ruby-dev \
 && sudo fluent-gem install fluent-plugin-mongo \
 && sudo gem sources --clear-all \
 && apk del .build-deps \
 && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

COPY docker.conf /fluentd/etc/
COPY entrypoint.sh /bin/

USER fluent