Fluentd
0.12
0.12
  • Introduction
  • Overview
    • Getting Started
    • Installation
    • Life of a Fluentd event
    • Support
    • FAQ
  • Use Cases
    • Centralized App Logging
    • Monitoring Service Logs
    • Data Analytics
    • Connecting to Data Storages
    • Stream Processing
    • Windows Event Collection
    • IoT Data Logger
  • Configuration
    • Config File Syntax
    • Routing Examples
    • Recipes
  • Deployment
    • Logging
    • Monitoring
    • Signals
    • RPC
    • High Availability Config
    • Failure Scenarios
    • Performance Tuning
    • Plugin Management
    • Trouble Shooting
    • Secure Forwarding
    • Fluentd UI
    • Command Line Option
  • Container Deployment
    • Docker Image
    • Docker Logging Driver
    • Docker Compose
    • Kubernetes
  • Input Plugins
    • tail
    • forward
    • secure_forward
    • udp
    • tcp
    • http
    • unix
    • syslog
    • exec
    • scribe
    • multiprocess
    • dummy
    • Others
  • Output Plugins
    • file
    • s3
    • kafka
    • forward
    • secure_forward
    • exec
    • exec_filter
    • copy
    • geoip
    • roundrobin
    • stdout
    • null
    • webhdfs
    • splunk
    • mongo
    • mongo_replset
    • relabel
    • rewrite_tag_filter
    • Others
  • Buffer Plugins
    • memory
    • file
  • Filter Plugins
    • record_transformer
    • grep
    • parser
    • stdout
  • Parser Plugins
    • regexp
    • apache2
    • apache_error
    • nginx
    • syslog
    • ltsv
    • csv
    • tsv
    • json
    • multiline
    • none
  • Formatter Plugins
    • out_file
    • json
    • ltsv
    • csv
    • msgpack
    • hash
    • single_value
  • Developer
    • Plugin Development
    • Community
    • Mailing List
    • Source Code
    • Bug Tracking
    • ChangeLog
    • Logo
  • Articles
    • Store Apache Logs into MongoDB
    • Apache To Riak
    • Store Apache Logs into Amazon S3
    • Before Install
    • Cep Norikra
    • Collect Glusterfs Logs
    • Common Log Formats
    • Docker Logging Efk Compose
    • Docker Logging
    • Filter Modify Apache
    • Forwarding Over Ssl
    • Free Alternative To Splunk By Fluentd
    • Data Collection to Hadoop (HDFS)
    • Data Analytics with Treasure Data
    • Install By Chef
    • Install By Deb
    • Install By Dmg
    • Install By Gem
    • Install By Rpm
    • Install From Source
    • Install On Beanstalk
    • Install On Heroku
    • Java
    • Kinesis Stream
    • Kubernetes Fluentd
    • Monitoring by Prometheus
    • Monitoring by Rest Api
    • Nodejs
    • Performance Tuning Multi Process
    • Performance Tuning Single Process
    • Perl
    • Php
    • Python
    • Quickstart
    • Raspberrypi Cloud Data Logger
    • Recipe Apache Logs To Elasticsearch
    • Recipe Apache Logs To Mongo
    • Recipe Apache Logs To S3
    • Recipe Apache Logs To Treasure Data
    • Recipe Cloudstack To Mongodb
    • Recipe Csv To Elasticsearch
    • Recipe Csv To Mongo
    • Recipe Csv To S3
    • Recipe Csv To Treasure Data
    • Recipe Http Rest Api To Elasticsearch
    • Recipe Http Rest Api To Mongo
    • Recipe Http Rest Api To S3
    • Recipe Http Rest Api To Treasure Data
    • Recipe Json To Elasticsearch
    • Recipe Json To Mongo
    • Recipe Json To S3
    • Recipe Json To Treasure Data
    • Recipe Nginx To Elasticsearch
    • Recipe Nginx To Mongo
    • Recipe Nginx To S3
    • Recipe Nginx To Treasure Data
    • Recipe Syslog To Elasticsearch
    • Recipe Syslog To Mongo
    • Recipe Syslog To S3
    • Recipe Syslog To Treasure Data
    • Recipe Tsv To Elasticsearch
    • Recipe Tsv To Mongo
    • Recipe Tsv To S3
    • Recipe Tsv To Treasure Data
    • Ruby
    • Scala
    • Splunk Like Grep And Alert Email
Powered by GitBook
On this page
  • fluent-gem
  • If Using td-agent, Use /usr/sbin/td-agent-gem
  • Gem and native extension
  • "-p" option
  • Add a Plugin Via /etc/fluent/plugin
  • If Using td-agent, Use /etc/td-agent/plugin
  • Plugin version management
  • "--gemfile" option

Was this helpful?

  1. Deployment

Plugin Management

PreviousPerformance TuningNextTrouble Shooting

Last updated 5 years ago

Was this helpful?

This article explains how to manage Fluentd plugins, including adding 3rd party plugins.

fluent-gem

The fluent-gem command is used to install Fluentd plugins. This is a wrapper around the gem command.

fluent-gem install fluent-plugin-grep

Ruby doesn't guarantee C extension API compatibility between its major versions. If you update Fluentd's Ruby version, you should re-install the plugins that depend on C extension.

If Using td-agent, Use /usr/sbin/td-agent-gem

If you are using td-agent, please make sure to use td-agent's td-agent-gem command. Otherwise (e.g. you use the command belonging to system, rvm, etc.), you won't be able to find your "installed" plugins.

Please see for more information.

Gem and native extension

Some plugins depend on natvie extension library. It means you need to install development packages to build it, e.g. gcc, make, autoconf and etc. If you see logs like below, install development packages before plugin installation.

Building native extensions.  This could take a while...
ERROR:  Error installing fluent-plugin-twitter:
        ERROR: Failed to build gem native extension.

    /opt/td-agent/embedded/bin/ruby extconf.rb

checking for rb_str_scrub()... yes
creating Makefile

make "DESTDIR = " clean
sh: 1: make: not found

make "DESTDIR = "
sh: 1: make: not found

make failed, exit code 127

Gem files will remain installed in /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/string-scrub-0.0.3 for inspection.
Results logged to /opt/td-agent/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/string-scrub-0.0.3/gem_make.out

"-p" option

Fluentd's -p option is used to add an extra plugin directory to the load path. For example, if you put the out_foo.rb plugin into /path/to/plugin, you can load the out_foo.rb plugin by specifying the -p option as shown below.

fluentd -p /path/to/plugin

You can specify the -p option more than once.

Add a Plugin Via /etc/fluent/plugin

Fluentd adds the /etc/fluent/plugin directory to its load path by default. Thus, any additional plugins that are placed in /etc/fluent/plugin will be loaded automatically.

For example, if /etc/fluent/plugin/out_foo.rb exists, you can use @type foo in <match>.

If Using td-agent, Use /etc/td-agent/plugin

If you are using td-agent, Fluentd uses the /etc/td-agent/plugin directory instead of /etc/fluent/plugin. Please put your plugins here instead.

Plugin version management

Fluentd and plugins are evolving, so you may hit unexpected error with latest version, e.g. regression by new feature, removed deprecated parameter,, change library dependency, etc. Avoiding these problems, we recommend to fix fluentd and plugin version on production. If you want to update fluentd or plugins, check the behaviour first on your test environment. For example, td-agent fixes fluentd and plugins version in each release.

Fluentd plugins are rubygems and rubygems installs latest version by default. So we don't recommend to execute following commands on production:

  • gem install fluentd

  • gem install fluent-plugin-elasticsearch

  • gem update # This is very dangerous. Update all existing gems

Another problem: if you install the plugin which depends on fluentd v0.14, gem installs fluentd v0.14 together even if you installed fluentd v0.12. This is unexpected result for fluentd v0.12 users.

You should specify target version with -v option.

  • gem install fluentd -v 0.12.43

  • gem install fluent-plugin-elasticsearch -v 1.9.3

/usr/sbin/td-agent-gem is also same because /usr/sbin/td-agent-gem uses gem command internally.

"--gemfile" option

For example, if you have following Gemfile at /etc/fluent/Gemfile:

source 'https://rubygems.org'

gem 'fluentd', '0.12.43'
gem 'fluent-plugin-elasticsearch', '1.9.3'

You can pass this Gemfile to Fluentd via the --gemfile option.

fluentd --gemfile /etc/fluent/Gemfile

When specifying the --gemfile option, Fluentd will try to install the listed gems using Bundler. Fluentd will only load listed gems separated from shared gems, and will also prevent unexpected plugin updates.

In addition, if you update Fluentd's Ruby version, Bundler will re-install the listed gems for the new Ruby version. This allows you to avoid the C extension API compatibility problem.

A Ruby application manages gem dependencies using Gemfile and . Fluentd's --gemfile option takes the same approach, and is useful for managing plugin versions separated from shared gems.

If this article is incorrect or outdated, or omits critical information, please . is a open source project under . All components are available under the Apache 2 License.

Bundler
let us know
Fluentd
Cloud Native Computing Foundation (CNCF)
this FAQ