toyokazu / fluent-plugin-mqtt-io

Fluent plugin for MQTT Input/Output
Apache License 2.0
17 stars 12 forks source link

MQTT/TLS AWS IoT Core Output plugin error #26

Open alvaronhs opened 2 years ago

alvaronhs commented 2 years ago

Hello i'm having some difficulties to send my json via MQTT to AWS IoT Core using this plugin, i got an error in the log below that i don't know what is causing it, i also don't know why it shows a message that cafile, certfile and keyfile are not being used.

The plugin was installed as documented, using the calyptia wrapper (calyptia-fluentd-gem).

calyptia-fluentd.conf

<match fluentd.test.**>
  @type mqtt
  host {redacted}.amazonaws.com
  port 8883
  topic_rewrite_pattern '^([\w\/]+)$'
  topic_rewrite_replacement 'test'
  <format>
    @type json
  </format>
  <security>
    use_tls true
    <tls>
    cafile AmazonRootCA1.pem
    certfile amazon-certificate.pem.crt
    keyfile amazon-private.pem.key
    </tls>
  </security>
  <buffer>
    chunk_limit_records 1
  </buffer>
</match>

/var/log/calyptia-fluentd/calyptia-fluentd.log:

[info]: Worker 0 finished unexpectedly with status 1
[info]: adding match pattern="debug.**" type="stdout"
[info]: adding match pattern="fluentd.test.**" type="mqtt"
[info]: adding source type="forward"
[info]: adding source type="http"
[info]: adding source type="debug_agent"
[warn]: parameter 'cafile' in <tls>
  cafile AmazonRootCA1.pem
  certfile amazon-certificate.pem.crt
  keyfile amazon-private.pem.key
</tls> is not used.
[warn]: parameter 'certfile' in <tls>
  cafile AmazonRootCA1.pem
  certfile amazon-certificate.pem.crt
  keyfile amazon-private.pem.key
</tls> is not used.
[warn]: parameter 'keyfile' in <tls>
  cafile AmazonRootCA1.pem
  certfile amazon-certificate.pem.crt
  keyfile amazon-private.pem.key
</tls> is not used.
[info]: #0 starting fluentd worker pid=162407 ppid=161566 worker=0
[info]: #0 [input_debug_agent] listening dRuby uri="druby://127.0.0.1:24230" object="Fluent::Engine" worker=0
[warn]: #0 thread exited by unexpected error plugin=Fluent::Plugin::MqttOutput title=:out_mqtt_proxy error_class=TypeError error="no implicit conversion of nil into String"
[error]: #0 unexpected error error_class=TypeError error="no implicit conversion of nil into String"
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:194:in `read'
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:194:in `cert_file='
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:168:in `block in initialize'
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:167:in `each_pair'
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/mqtt-0.5.0/lib/mqtt/client.rb:167:in `initialize'
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/fluent-plugin-mqtt-io-0.5.0/lib/fluent/plugin/mqtt_proxy.rb:83:in `new'
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/fluent-plugin-mqtt-io-0.5.0/lib/fluent/plugin/mqtt_proxy.rb:83:in `proxy'
  [error]: #0 /opt/calyptia-fluentd/lib/ruby/gems/3.0.0/gems/fluentd-1.14.3/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
[error]: #0 unexpected error error_class=TypeError error="no implicit conversion of nil into String"
  [error]: #0 suppressed same stacktrace
[info]: Worker 0 finished unexpectedly with status 1

I removed the timestamps for better readability.