Fluentd
Search…
0.12
Powered By GitBook
Forwarding Over Ssl

Overview

This is a quick tutorial on how to use the secure forward plugin to enable SSL for Fluentd-to-Fluentd data transport.
It is intended as a quick introduction. For comprehensive documentation, including parameter definitions, please checkout out the out_secure_forward and in_secure_forward.

Setup: Receiver

First, install the secure forward plugin.
    Fluentd: gem install fluent-plugin-secure-forward
    td-agent v2:
    /usr/sbin/td-agent-gem install fluent-plugin-secure-forward
    td-agent v1:
    /usr/lib/fluent/ruby/bin/fluent-gem install fluent-plugin-secure-forward
Then, set up the configuration file as follows:
1
<source>
2
@type secure_forward
3
shared_key YOUR_SHARED_KEY
4
self_hostname server.fqdn.local
5
cert_auto_generate yes
6
</source>
7
8
<match secure.**>
9
@type stdout
10
</match>
Copied!
The <match> clause is there to print out the forwarded message into STDOUT (which is fed into var/log/td-agent/td-agent.log for td-agent) using out_stdout.
Then, (re)start Fluentd/td-agent.

Setup: Sender

First, install the secure forward plugin.
    Fluentd: fluent-gem install fluent-plugin-secure-forward
    td-agent v2:
    /usr/sbin/td-agent-gem install fluent-plugin-secure-forward
    td-agent v1:
    /usr/lib/fluent/ruby/bin/fluent-gem install fluent-plugin-secure-forward
Then, set up the configuration file as follows:
1
<source>
2
@type forward
3
</source>
4
5
<match secure.**>
6
@type secure_forward
7
shared_key YOUR_SHARED_KEY
8
self_hostname "#{Socket.gethostname}"
9
<server>
10
host RECEIVER_IP
11
port 24284
12
</server>
13
</match>
Copied!
The <source> clause is there to feed test data into Fluentd using in_forward. Make sure that YOUR_SHARED_KEY is same with the receiver's.
Then, (re)start td-agent.

Confirm: Send an Event Over SSL

On the sender machine, run the following command using fluent-cat
    Fluentd:
    echo '{"message":"testing the SSL forwarding"}' | fluent-cat --json secure.test
    td-agent v2:
    echo '{"message":"testing the SSL forwarding"}' | /opt/td-agent/embedded/bin/fluent-cat --json secure.test
    td-agent v1:
    echo '{"message":"testing the SSL forwarding"}' | /usr/lib/fluent/ruby/bin/fluent-cat --json secure.test
Now, checking the receiver's Fluentd's log (for td-agent, this would be /var/log/td-agent/td-agent.log), there should be a line like this:
1
2014-10-21 18:18:26 -0400 secure.test: {"message":"testing the SSL forwarding"}
Copied!

Resources

If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is a open source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last modified 1yr ago