Versions | v0.14 (td-agent3) | v0.12 (td-agent2) | v0.10 (td-agent1)

This page is for v0.14, not the latest stable version which is v0.12. For the latest stable version of this article, click here.

Installing Fluentd Using Ruby Gem

This article explains how to install Fluentd using Ruby gem.

Table of Contents

Step0: Before Installation

Please follow the Preinstallation Guide to configure your OS properly. This will prevent many unnecessary problems.

Step1: Install Ruby interpreter

Please install Ruby >= 2.1 on your local environment. In addition, install ruby-dev package via package manager to build native extension gems.

Step2: Install Fluentd gem

Fetch and install the fluentd Ruby gem using the gem command. The official ruby gem page is here.

$ gem install fluentd --no-ri --no-rdoc

Step3: Run

Run the following commands to confirm that Fluentd was installed successfully:

$ fluentd --setup ./fluent
$ fluentd -c ./fluent/fluent.conf -vv &
$ echo '{"json":"message"}' | fluent-cat debug.test

The last command sends Fluentd a message ‘{“json”:”message”}’ with a “debug.test” tag. If the installation was successful, Fluentd will output the following message:

2011-07-10 16:49:50 +0900 debug.test: {"json":"message"}
It's HIGHLY recommended that you set up ntpd on the node to prevent invalid timestamps in your logs.
For large deployments, you must use jemalloc to avoid memory fragmentation. This is already included in the rpm and deb packages.
The Fluentd gem doesn't come with /etc/init.d/ scripts. You should use process management tools such as daemontools, runit, supervisord, or upstart.

Next Steps

You’re now ready to collect your real logs using Fluentd. Please see the following tutorials to learn how to collect your data from various data sources.

Last updated: 2016-06-13 06:11:23 UTC

Versions | v0.14 (td-agent3) | v0.12 (td-agent2) | v0.10 (td-agent1)

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), originally invented by Treasure Data, Inc. All components are available under the Apache 2 License.

Interested in the Fluentd Newsletters?