toyokazu / fluent-plugin-mqtt-io

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

[WIP]enable security and tls option #6

Closed toshitanian closed 6 years ago

toshitanian commented 6 years ago

This will solves #5

toshitanian commented 6 years ago

It looks working now comparing to #5

2018-01-05 04:10:53 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
2018-01-05 04:10:53, +0000 [info]: using configuration file: <ROOT>
  <source>
    @type forward
    @id input1
    @label @mainstream
    port 24224
  </source>
  <label @mainstream>
    <match **>
      @type mqtt
      host "localhost"
      port 8883
      <format>
        @type "json"
        add_newline false
      </format>
      <security>
        use_tls true
        <tls>
          ca_file "/cert/cacert.pem"
          key_file "/cert/private.key"
          cert_file "/cert/cert.pem"
        </tls>
      </security>
    </match>
  </label>
</ROOT>
2018-01-05 04:10:53 +0000 [info]: starting fluentd-0.14.25 pid=7 ruby="2.3.3"
2018-01-05 04:10:53 +0000 [info]: spawn command to main:  cmdline=["/usr/bin/ruby2.3", "-Eascii-8bit:ascii-8bit", "/usr/local/bin/fluentd", "-c", "/fluentd/etc/fluent.conf", "-p", "/fluentd/plugins", "--under-supervisor"]
2018-01-05 04:10:54 +0000 [info]: gem 'fluent-plugin-mqtt-io' version '0.3.8'
2018-01-05 04:10:54 +0000 [info]: gem 'fluentd' version '0.14.25'
2018-01-05 04:10:54 +0000 [info]: gem 'fluentd' version '0.12.42'
2018-01-05 04:10:54 +0000 [info]: adding match in @mainstream pattern="**" type="mqtt"
2018-01-05 04:10:54 +0000 [info]: adding source type="forward"
2018-01-05 04:10:54 +0000 [info]: #0 starting fluentd worker pid=23 ppid=7 worker=0
2018-01-05 04:10:54 +0000 [info]: #0 [input1] listening port port=24224 bind="0.0.0.0"
2018-01-05 04:10:54 +0000 [info]: #0 fluentd worker is now running worker=0
toyokazu commented 6 years ago

Thank you for your contribution! TLS related codes haven't been tested yet. I also tested with mosquitto and successfully connected with your updates :) client_id is also important for logging at brokers. Thanks!