Fluent::Plugin::Elasticsearch, a plugin for Fluentd Send your logs to Elasticsearch (and search them with Kibana maybe?) Note: For Amazon E…
Fluent::Plugin::Elasticsearch, a plugin for Fluentd Send your logs to Elasticsearch (and search them with Kibana maybe?) Note: For Amazon E…
Send your logs to Elasticsearch (and search them with Kibana maybe?)
Note: For Amazon Elasticsearch Service please consider using fluent-plugin-aws-elasticsearch-service
Current maintainers: Hiroshi Hatake | @cosmo0920, Kentaro Hayashi | @kenhys
| fluent-plugin-elasticsearch | fluentd | ruby |
|---|---|---|
| >= 4.0.1 | >= v0.14.22 | >= 2.3 |
| >= 3.2.4 && = v0.14.22 | >= 2.1 | |
| >= 2.0.0 && = v0.14.20 | >= 2.1 | |
| = v0.12.0 | >= 1.9 |
[!IMPORTANT] You need to change the version of
elasticsearchgem, according to the version of Elasticsearch you use. Please refer to the following example.
NOTE: Since fluent-plugin-elasticsearch 5.3.0, it requires faraday 2.0 or later.
NOTE: For v0.12 version, you should use 1.x.y version. Please send patch into v0.12 branch if you encountered 1.x version's bug.
NOTE: This documentation is for fluent-plugin-elasticsearch 2.x or later. For 1.x documentation, please see v0.12 branch.
NOTE: Using Index Lifecycle management(ILM) feature needs to install elasticsearch-xpack gem v7.4.0 or later.
$ gem install fluent-plugin-elasticsearchIn your Fluentd configuration, use @type elasticsearch. Additional configuration is optional, default values would look like this:
@type elasticsearch
host localhost
port 9200
index_name fluentd
type_name fluentd
NOTE: type_name parameter will be used fixed _doc value for Elasticsearch 7.
NOTE: type_name parameter will make no effect for Elasticsearch 8.
This plugin creates Elasticsearch indices by merely writing to them. Consider using Index Templates to gain control of what get indexed and how. See this example for a good starting point.
host user-custom-host.domain # default localhostYou can specify Elasticsearch host by this parameter.
Note: Since v3.3.2, host parameter supports builtin placeholders. If you want to send events dynamically into different hosts at runtime with elasticsearch_dynamic output plugin, please consider to switch to use plain elasticsearch output plugin. In more detail for builtin placeholders, please refer to Placeholders section.
To use IPv6 address on host parameter, you can use the following styles:
To use string style, you must quote IPv6 address due to prevent to be interpreted as JSON:
host "[2404:7a80:d440:3000:192a:a292:bd7f:ca10]"You can also specify raw IPv6 address. This will be handled as [specified IPv6 address]:
host 2404:7a80:d440:3000:192a:a292:bd7f:ca10port 9201 # defaults to 9200You can specify Elasticsearch port by this parameter.
cloud_id test-dep:ZXVyb3BlLXdlc3QxLmdjcC5jbG91ZC5lcy5pbyRiYZTA1Ng==You can specify Elasticsearch cloud_id by this parameter.
If you specify cloud_id option then cloud_auth option is required.
If you specify cloud_id option, host, port, user and password options are ignored.
cloud_auth 'elastic:slkjdaooewkd87iqQ2O8EQYV'You can specify Elasticsearch cloud_auth by this parameter.
emit_error_for_missing_id trueWhen write_operation is configured to anything other then index, setting this value to true will
cause the plugin to emit_error_event of any records which do not include an _id field. The default (false)
behavior is to silently drop the records.
hosts host1:port1,host2:port2,host3:port3You can specify multiple Elasticsearch hosts with separator ",".
If you specify multiple hosts, this plugin will load balance updates to Elasticsearch. This is an elasticsearch-ruby feature, the default strategy is round-robin.
If you specify hosts option, host and port options are ignored.
host user-custom-host.domain # ignored
port 9200 # ignored
hosts host1:port1,host2:port2,host3:port3If you specify hosts option without port, port option is used.
port 9200
hosts host1:port1,host2:port2,host3 # port3 is 9200Note: If you will use scheme https, do not include "https://" in your hosts ie. host "https://domain", this will cause ES cluster to be unreachable and you will receive an error "Can not reach Elasticsearch cluster"
Note: Up until v2.8.5, it was allowed to embed the username/password in the URL. However, this syntax is deprecated as of v2.8.6 because it was found to cause serious connection problems (See #394). Please migrate your settings to use the user and password field (described below) instead.
When you want to specify IPv6 addresses, you must specify schema together:
hosts http://[2404:7a80:d440:3000:de:7311:6329:2e6c]:port1,http://[2404:7a80:d440:3000:de:7311:6329:1e6c]:port2,http://[2404:7a80:d440:3000:de:6311:6329:2e6c]:port3If you don't specify hosts with schema together, Elasticsearch plugin complains Invalid URI for them.
user demo
password secret
path /elastic_search/
scheme httpsYou can specify user and password for HTTP Basic authentication.
And this plugin will escape required URL encoded characters within %{} placeholders.
user %{demo+}
password %{@secret}Specify ssl_verify false to skip ssl verification (defaults to true)
logstash_format true # defaults to falseThis is meant to make writing data into Elasticsearch indices compatible to what Logstash calls them. By doing this, one could take advantage of Kibana. See logstash_prefix and logstash_dateformat to customize this index name pattern. The index name will be #{logstash_prefix}-#{formatted_date}
:warning: Setting this option to true will ignore the index_name setting. The default index name prefix is logstash-.
include_timestamp true # defaults to falseAdds a @timestamp field to the log, following all settings logstash_format does, except without the restrictions on index_name. This allows one to log to an alias in Elasticsearch and utilize the rollover API.
logstash_prefix mylogs # defaults to "logstash"logstash_prefix_separator _ # defaults to "-"The strftime format to generate index target index name when logstash_format is set to true. By default, the records are inserted into index logstash-YYYY.MM.DD. This option, alongw
No open issues yet, or sync has not completed.