Closed otokunaga2 closed 4 years ago
Hi,
I've also tested in the following environment without any errors. In your error message, the following error seems to indicate the root cause.
/home/otokunaga2/work/fluent-plugin-mqtt-io/lib/fluent/plugin/out_mqtt.rb:4:in `<top (required)>'
You are trying the plugin without installing it by gem but just downloading it to your local folder. It requires you to set $LOAD_PATH. Please confirm your environment again.
Best regards
Ubuntu 18.04.4
rruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
fluent-plugin-mqtt-io (0.4.4)
fluentd (1.10.4)
sudo apt install ruby ruby-dev mosquitto
sudo gem install fluent-plugin-mqtt-io
mkdir fluentd
cd fluentd
git clone https://github.com/OpenVPN/easy-rsa.git
cd easy-rsa/easyrsa3
./easyrsa init-pki
./easyrsa build-ca
./easyrsa gen-req localhost nopass
./easyrsa sign-req server localhost
./easyrsa gen-req client nopass
./easyrsa sign-req client client
cd ../../
vi fluent-in_mqtt-tls.conf
---
<source>
@type mqtt
host localhost
port 8883
topic test
<parse>
@type none
</parse>
<security>
use_tls true
<tls>
ca_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/ca.crt
cert_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/issued/client.crt
key_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/private/client.key
</tls>
</security>
@label @test
</source>
<label @test>
<match **>
@type stdout
</match>
</label>
---
vi fluent-out_mqtt-tls.conf
---
<source>
@type mqtt
host localhost
port 8883
topic test
<parse>
@type none
</parse>
<security>
use_tls true
<tls>
ca_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/ca.crt
cert_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/issued/client.crt
key_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/private/client.key
</tls>
</security>
@label @test
</source>
<label @test>
<match **>
@type mqtt
host localhost
port 8883
topic_rewrite_pattern '^([\w\/]+)$'
topic_rewrite_replacement '\1/rewritten'
<security>
use_tls true
<tls>
ca_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/ca.crt
cert_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/issued/client.crt
key_file /home/ubuntu/fluentd/easy-rsa/easyrsa3/pki/private/client.key
</tls>
</security>
<monitor>
send_time true
</monitor>
#<buffer>
#@type file
#path /var/log/td-agent/mqtt/topic/enrichportal/log
#flush_interval 10s
#</buffer>
</match>
</label>
---
# start fluentd (input)
fluentd -v -c fluent-in_mqtt-tls.conf
# test publish to the topic “test”
mosquitto_pub -h localhost -p 8883 -t test -m "hoge" --cert easy-rsa/easyrsa3/pki/issued/client.crt --key easy-rsa/easyrsa3/pki/private/client.key --cafile easy-rsa/easyrsa3/pki/ca.crt
# start fluentd (output)
fluentd -v -c fluent-out_mqtt-tls.conf
# subscribe a topic test/rewritten by mosquitto_sub
mosquitto_sub -h localhost -p 8883 -t test/rewritten --cert easy-rsa/easyrsa3/pki/issued/client.crt --key easy-rsa/easyrsa3/pki/private/client.key --cafile easy-rsa/easyrsa3/pki/ca.crt
# test publish to the topic “test”
mosquitto_pub -h localhost -p 8883 -t test -m "hoge" --cert easy-rsa/easyrsa3/pki/issued/client.crt --key easy-rsa/easyrsa3/pki/private/client.key --cafile easy-rsa/easyrsa3/pki/ca.crt
If you want to test locally modified version from github image, please try "rake build" and "gem install pkg/fluent-plugin-mqtt-io-x.x.x.gem" to install the modified gem into your gem folder.
Hi, thank you for your kind and quick reply. I have totally resolved my issue with your advice. Thank you very much.
As you mentioned, the path issue is based on my environment, so I close both my PR and this issue.
Best,
Hello. I would like to report that I caused an error both input & output plugin in my environment.
I suspect that original Fluentd is currently major updated. Hence, the plugin's structure seems a little changed and which may influenced. The detailed information is as follows. To cope the issue I create the PR, so could you check?
My environment.
Fluentd config(output plugin)
Stacktraces