The es output plugin, allows to ingest your records into a Elasticsearch database. The following instructions assumes that you have a fully operational Elasticsearch service running in your environment.
IP address or hostname of the target Elasticsearch instance
TCP port of the target Elasticsearch instance
Elasticsearch accepts new data on HTTP query path "/_bulk". But it is also possible to serve Elasticsearch behind a reverse proxy on a subpath. This option defines such path on the fluent-bit side. It simply adds a path prefix in the indexing HTTP POST URI.
Specify the buffer size used to read the response from the Elasticsearch HTTP service. This option is useful for debugging purposes where is required to read full responses, note that response size grows depending of the number of records inserted. To set an unlimited amount of memory set this value to False, otherwise the value must be according to the Unit Size specification.
Newer versions of Elasticsearch allows to setup filters called pipelines. This option allows to define which pipeline the database should use. For performance reasons is strongly suggested to do parsing and filtering on Fluent Bit side, avoid pipelines.
Enable AWS Sigv4 Authentication for Amazon ElasticSearch Service
Specify the AWS region for Amazon ElasticSearch Service
AWS IAM Role to assume to put records to your Amazon ES cluster
External ID for the AWS IAM Role specified with
Optional username credential for Elastic X-Pack access
Password for user defined in HTTP_User
Enable Logstash format compatibility. This option takes a boolean value: True/False, On/Off
When Logstash_Format is enabled, the Index name is composed using a prefix and the date, e.g: If Logstash_Prefix is equals to 'mydata' your index will become 'mydata-YYYY.MM.DD'. The last string appended belongs to the date when the data is being generated.
Time format (based on strftime) to generate the second part of the Index name.
When Logstash_Format is enabled, each record will get a new timestamp field. The Time_Key property defines the name of that field.
When Logstash_Format is enabled, this property defines the format of the timestamp.
When enabled, it append the Tag name to the record.
When Include_Tag_Key is enabled, this property defines the key name for the tag.
When enabled, generate
When enabled, replace field name dots with underscore, required by Elasticsearch 2.0-2.3.
When enabled print the elasticsearch API calls to stdout (for diag only)
Use current time for index generation instead of message record
When included: the value in the record that belongs to the key will be looked up and over-write the Logstash_Prefix for index generation. If the key/value is not found in the record then the Logstash_Prefix option will act as a fallback. Nested keys are not supported (if desired, you can use the nest filter plugin to remove nesting)
The parameters index and type can be confusing if you are new to Elastic, if you have used a common relational database before, they can be compared to the database and table concepts. Also see the FAQ below
Elasticsearch output plugin supports TTL/SSL, for more details about the properties available and general configuration, please refer to the TLS/SSL section.
In order to insert records into a Elasticsearch service, you can run the plugin from the command line or through the configuration file:
The es plugin, can read the parameters from the command line in two ways, through the -p argument (property) or setting them directly through the service URI. The URI format is the following:
Using the format specified, you could start Fluent Bit through:
$ fluent-bit -i cpu -t cpu -o es://192.168.2.3:9200/my_index/my_type \-o stdout -m '*'
which is similar to do:
$ fluent-bit -i cpu -t cpu -o es -p Host=192.168.2.3 -p Port=9200 \-p Index=my_index -p Type=my_type -o stdout -m '*'
In your main configuration file append the following Input & Output sections:
[INPUT]Name cpuTag cpu[OUTPUT]Name esMatch *Host 192.168.2.3Port 9200Index my_indexType my_type
Some input plugins may generate messages where the field names contains dots, since Elasticsearch 2.0 this is not longer allowed, so the current es plugin replaces them with an underscore, e.g:
Since Elasticsearch 6.0, you cannot create multiple types in a single index. This means that you cannot set up your configuration as below anymore.
[OUTPUT]Name esMatch foo.*Index searchType type1[OUTPUT]Name esMatch bar.*Index searchType type2
If you see an error message like below, you'll need to fix your configuration to use a single type on each index.
Rejecting mapping update to [search] as the final mapping would have more than 1 type
For details, please read the official blog post on that issue.
Fluent Bit v1.5 changed the default mapping type from
_doc, which matches the recommendation from Elasticsearch from version 6.2 forwards (see commit with rationale). This doesn't work in Elasticsearch versions 5.6 through 6.1 (see Elasticsearch discussion and fix). Ensure you set an explicit map (such as
flb_type) in the configuration, as seen on the last line:
[OUTPUT]Name esMatch *Host vpc-test-domain-ke7thhzoo7jawsrhmm6mb7ite7y.us-west-2.es.amazonaws.comPort 443Index my_indexAWS_Auth OnAWS_Region us-west-2tls OnType doc
The Amazon ElasticSearch Service adds an extra security layer where HTTP requests must be signed with AWS Sigv4. Fluent Bit v1.5 introduced full support for Amazon ElasticSearch Service with IAM Authentication.
Fluent Bit supports sourcing AWS credentials from any of the standard sources (for example, an Amazon EKS IAM Role for a Service Account).
[OUTPUT]Name esMatch *Host vpc-test-domain-ke7thhzoo7jawsrhmm6mb7ite7y.us-west-2.es.amazonaws.comPort 443Index my_indexType my_typeAWS_Auth OnAWS_Region us-west-2tls On
Notice that the
Port is set to
tls is enabled, and
AWS_Region is set.