Giter Site home page Giter Site logo

fluent-plugin-elasticsearch's Introduction

Fluent::Plugin::Elasticsearch, a plugin for Fluentd

Gem Version Testing on Windows Testing on macOS Testing on Ubuntu Code Climate

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

Requirements

fluent-plugin-elasticsearch fluentd ruby
>= 4.0.1 >= v0.14.22 >= 2.3
>= 3.2.4 && < 4.0.1 >= v0.14.22 >= 2.1
>= 2.0.0 && < 3.2.3 >= v0.14.20 >= 2.1
< 2.0.0 >= v0.12.0 >= 1.9

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.

Installation

$ gem install fluent-plugin-elasticsearch

Usage

In your Fluentd configuration, use @type elasticsearch. Additional configuration is optional, default values would look like this:

<match my.logs>
  @type elasticsearch
  host localhost
  port 9200
  index_name fluentd
  type_name fluentd
</match>

NOTE: type_name parameter will be used fixed _doc value for Elasticsearch 7.

NOTE: type_name parameter will make no effect for Elasticsearch 8.

Index templates

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.

Configuration

host

host user-custom-host.domain # default localhost

You 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:

string style

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]"

raw style

You can also specify raw IPv6 address. This will be handled as [specified IPv6 address]:

host 2404:7a80:d440:3000:192a:a292:bd7f:ca10

port

port 9201 # defaults to 9200

You can specify Elasticsearch port by this parameter.

cloud_id

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

cloud_auth 'elastic:slkjdaooewkd87iqQ2O8EQYV'

You can specify Elasticsearch cloud_auth by this parameter.

emit_error_for_missing_id

emit_error_for_missing_id true

When 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

hosts host1:port1,host2:port2,host3:port3

You 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:port3

If you specify hosts option without port, port option is used.

port 9200
hosts host1:port1,host2:port2,host3 # port3 is 9200

Note: 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.

IPv6 addresses

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]:port3

If you don't specify hosts with schema together, Elasticsearch plugin complains Invalid URI for them.

user, password, path, scheme, ssl_verify

user demo
password secret
path /elastic_search/
scheme https

You 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

logstash_format true # defaults to false

This 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}

โš ๏ธ Setting this option to true will ignore the index_name setting. The default index name prefix is logstash-.

include_timestamp

include_timestamp true # defaults to false

Adds 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

logstash_prefix mylogs # defaults to "logstash"

logstash_prefix_separator

logstash_prefix_separator _ # defaults to "-"

logstash_dateformat

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, alongwith logstash_prefix lets us insert into specified index like mylogs-YYYYMM for a monthly index.

logstash_dateformat %Y.%m. # defaults to "%Y.%m.%d"

pipeline

Only in ES >= 5.x is available to use this parameter. This param is to set a pipeline id of your elasticsearch to be added into the request, you can configure ingest node. For more information: [Ingest node]

pipeline pipeline_id

time_key_format

The format of the time stamp field (@timestamp or what you specify with time_key). This parameter only has an effect when logstash_format is true as it only affects the name of the index we write to. Please see Time#strftime for information about the value of this format.

Setting this to a known format can vastly improve your log ingestion speed if all most of your logs are in the same format. If there is an error parsing this format the timestamp will default to the ingestion time. If you are on Ruby 2.0 or later you can get a further performance improvement by installing the "strptime" gem: fluent-gem install strptime.

For example to parse ISO8601 times with sub-second precision:

time_key_format %Y-%m-%dT%H:%M:%S.%N%z

time_precision

Should the record not include a time_key, define the degree of sub-second time precision to preserve from the time portion of the routed event.

For example, should your input plugin not include a time_key in the record but it able to pass a time to the router when emitting the event (AWS CloudWatch events are an example of this), then this setting will allow you to preserve the sub-second time resolution of those events. This is the case for: fluent-plugin-cloudwatch-ingest.

time_key

By default, when inserting records in Logstash format, @timestamp is dynamically created with the time at log ingestion. If you'd like to use a custom time, include an @timestamp with your record.

{"@timestamp": "2014-04-07T000:00:00-00:00"}

You can specify an option time_key (like the option described in tail Input Plugin) to replace @timestamp key.

Suppose you have settings

logstash_format true
time_key vtm

Your input is:

{
  "title": "developer",
  "vtm": "2014-12-19T08:01:03Z"
}

The output will be

{
  "title": "developer",
  "@timestamp": "2014-12-19T08:01:03Z",
  "vtm": "2014-12-19T08:01:03Z"
}

See time_key_exclude_timestamp to avoid adding @timestamp.

time_key_exclude_timestamp

time_key_exclude_timestamp false

By default, setting time_key will copy the value to an additional field @timestamp. When setting time_key_exclude_timestamp true, no additional field will be added.

utc_index

utc_index true

By default, the records inserted into index logstash-YYMMDD with UTC (Coordinated Universal Time). This option allows to use local time if you describe utc_index to false.

suppress_type_name

In Elasticsearch 7.x, Elasticsearch cluster complains the following types removal warnings:

{"type": "deprecation", "timestamp": "2020-07-03T08:02:20,830Z", "level": "WARN", "component": "o.e.d.a.b.BulkRequestParser", "cluster.name": "docker-cluster", "node.name": "70dd5c6b94c3", "message": "[types removal] Specifying types in bulk requests is deprecated.", "cluster.uuid": "NoJJmtzfTtSzSMv0peG8Wg", "node.id": "VQ-PteHmTVam2Pnbg7xWHw"  }

This can be suppressed with:

suppress_type_name true

target_index_key

Tell this plugin to find the index name to write to in the record under this key in preference to other mechanisms. Key can be specified as path to nested record using dot ('.') as a separator.

If it is present in the record (and the value is non falsy) the value will be used as the index name to write to and then removed from the record before output; if it is not found then it will use logstash_format or index_name settings as configured.

Suppose you have the following settings

target_index_key @target_index
index_name fallback

If your input is:

{
  "title": "developer",
  "@timestamp": "2014-12-19T08:01:03Z",
  "@target_index": "logstash-2014.12.19"
}

The output would be

{
  "title": "developer",
  "@timestamp": "2014-12-19T08:01:03Z",
}

and this record will be written to the specified index (logstash-2014.12.19) rather than fallback.

target_type_key

Similar to target_index_key config, find the type name to write to in the record under this key (or nested record). If key not found in record - fallback to type_name (default "fluentd").

target_index_affinity

Enable plugin to dynamically select logstash time based target index in update/upsert operations based on already indexed data rather than current time of indexing.

target_index_affinity true # defaults to false

By default plugin writes data of logstash format index based on current time. For example daily based index after mignight data is written to newly created index. This is normally ok when data is coming from single source and not updated after indexing.

But if you have a use case where data is also updated after indexing and id_key is used to identify the document uniquely for updating. Logstash format is wanted to be used for easy data managing and retention. Updates are done right after indexing to complete the data (all data not available from single source) and no updates are done anymore later point on time. In this case problem happends at index rotation time where write to 2 indexes with same id_key value may happen.

This setting will search existing data by using elastic search's id query using id_key value (with logstash_prefix and logstash_prefix_separator index pattarn e.g. logstash-*). The index of found data is used for update/upsert. When no data is found, data is written to current logstash index as normally.

This setting requires following other settings:

logstash_format true
id_key myId  # Some field on your data to identify the data uniquely
write_operation upsert  # upsert or update

Suppose you have the following situation where you have 2 different match to consume data from 2 different Kafka topics independently but close in time with each other (order not known).

  <match data1>
    @type elasticsearch
    ...
    id_key myId
    write_operation upsert
    logstash_format true
    logstash_dateformat %Y.%m.%d
    logstash_prefix myindexprefix
    target_index_affinity true
    ...

  <match data2>
    @type elasticsearch
    ...
    id_key myId
    write_operation upsert
    logstash_format true
    logstash_dateformat %Y.%m.%d
    logstash_prefix myindexprefix
    target_index_affinity true
    ...

If your first (data1) input is:

{
  "myId": "myuniqueId1",
  "datafield1": "some value",
}

and your second (data2) input is:

{
  "myId": "myuniqueId1",
  "datafield99": "some important data from other source tightly related to id myuniqueId1 and wanted to be in same document.",
}

Date today is 10.05.2021 so data is written to index myindexprefix-2021.05.10 when both data1 and data2 is consumed during today. But when we are close to index rotation and data1 is consumed and indexed at 2021-05-10T23:59:55.59707672Z and data2 is consumed a bit later at 2021-05-11T00:00:58.222079Z i.e. logstash index has been rotated and normally data2 would have been written to index myindexprefix-2021.05.11. But with target_index_affinity setting as value true, data2 is now written to index myindexprefix-2021.05.10 into same document with data1 as wanted and duplicated document is avoided.

template_name

The name of the index template to create on fluentd startup. If a template by the name given is already present, it will be left unchanged, unless template_overwrite is set, in which case the template will be updated.

This parameter along with template_file allow the plugin to behave similarly to Logstash (it installs a template at creation time) so that raw records are available. See #33.

template_file must also be specified.

template_file

The path to the file containing the template to install.

template_name must also be specified.

templates

Specify index templates (to be created on startup) in the form of a hash (accepts JSON dict). Can contain multiple templates.

templates { "template_name_1": "path_to_template_1_file", "template_name_2": "path_to_template_2_file"}

Note: Before ES plugin v4.1.2, if template_file and template_name are set, then this parameter will be ignored. In 4.1.3 or later, template_file and template_name can work with templates.

customize_template

Specify the string and its value to be replaced in form of hash. Can contain multiple key value pair that would be replaced in the specified template_file. This setting only creates template and to add rollover index please check the rollover_index configuration.

customize_template {"string_1": "subs_value_1", "string_2": "subs_value_2"}

If template_file and template_name are set, then this parameter will be in effect otherwise ignored.

rollover_index

Specify this as true when an index with rollover capability needs to be created. It creates an index with the format <logstash-default-{now/d}-000001> where logstash denotes the index_prefix and default denotes the application_name which can be set. 'deflector_alias' is a required field for rollover_index set to true. 'index_prefix' and 'application_name' are optional and defaults to logstash and default respectively.

rollover_index true # defaults to false

If customize_template is set, then this parameter will be in effect otherwise ignored.

index_date_pattern

Specify this to override the index date pattern for creating a rollover index. The default is to use "now/d", for example: <logstash-default-{now/d}-000001>. Overriding this changes the rollover time period. Setting "now/w{xxxx.ww}" would create weekly rollover indexes instead of daily.

This setting only takes effect when combined with the enable_ilm setting.

index_date_pattern "now/w{xxxx.ww}" # defaults to "now/d"

If empty string("") is specified in index_date_pattern, index date pattern is not used. Elasticsearch plugin just creates <target_index-application_name-000001> rollover index instead of <target_index-application_name-{index_date_pattern}-000001>.

If customize_template is set, then this parameter will be in effect otherwise ignored.

deflector_alias

Specify the deflector alias which would be assigned to the rollover index created. This is useful in case of using the Elasticsearch rollover API

deflector_alias test-current

If rollover_index is set, then this parameter will be in effect otherwise ignored.

NOTE: Since 4.1.1, deflector_alias is prohibited to use with enable_ilm.

index_prefix

This parameter is marked as obsoleted. Consider to use index_name for specify ILM target index when not using with logstash_format. When specifying logstash_format as true, consider to use logstash_prefix to specify ILM target index prefix.

application_name

Specify the application name for the rollover index to be created.

application_name default # defaults to "default"

If enable_ilm is set, then this parameter will be in effect otherwise ignored.

template_overwrite

Always update the template, even if it already exists.

template_overwrite true # defaults to false

One of template_file or templates must also be specified if this is set.

max_retry_putting_template

You can specify times of retry putting template.

This is useful when Elasticsearch plugin cannot connect Elasticsearch to put template. Usually, booting up clustered Elasticsearch containers are much slower than launching Fluentd container.

max_retry_putting_template 15 # defaults to 10

fail_on_putting_template_retry_exceed

Indicates whether to fail when max_retry_putting_template is exceeded. If you have multiple output plugin, you could use this property to do not fail on fluentd statup.

fail_on_putting_template_retry_exceed false # defaults to true

fail_on_detecting_es_version_retry_exceed

Indicates whether to fail when max_retry_get_es_version is exceeded. If you want to use fallback mechanism for obtaining ELasticsearch version, you could use this property to do not fail on fluentd statup.

fail_on_detecting_es_version_retry_exceed false

And the following parameters should be working with:

verify_es_version_at_startup true
max_retry_get_es_version 2 # greater than 0.
default_elasticsearch_version 7 # This version is used when occurring fallback.

max_retry_get_es_version

You can specify times of retry obtaining Elasticsearch version.

This is useful when Elasticsearch plugin cannot connect Elasticsearch to obtain Elasticsearch version. Usually, booting up clustered Elasticsearch containers are much slower than launching Fluentd container.

max_retry_get_es_version 17 # defaults to 15

request_timeout

You can specify HTTP request timeout.

This is useful when Elasticsearch cannot return response for bulk request within the default of 5 seconds.

request_timeout 15s # defaults to 5s

reload_connections

You can tune how the elasticsearch-transport host reloading feature works. By default it will reload the host list from the server every 10,000th request to spread the load. This can be an issue if your Elasticsearch cluster is behind a Reverse Proxy, as Fluentd process may not have direct network access to the Elasticsearch nodes.

reload_connections false # defaults to true

reload_on_failure

Indicates that the elasticsearch-transport will try to reload the nodes addresses if there is a failure while making the request, this can be useful to quickly remove a dead node from the list of addresses.

reload_on_failure true # defaults to false

resurrect_after

You can set in the elasticsearch-transport how often dead connections from the elasticsearch-transport's pool will be resurrected.

resurrect_after 5s # defaults to 60s

include_tag_key, tag_key

include_tag_key true # defaults to false
tag_key tag # defaults to tag

This will add the Fluentd tag in the JSON record. For instance, if you have a config like this:

<match my.logs>
  @type elasticsearch
  include_tag_key true
  tag_key _key
</match>

The record inserted into Elasticsearch would be

{"_key": "my.logs", "name": "Johnny Doeie"}

id_key

id_key request_id # use "request_id" field as a record id in ES

By default, all records inserted into Elasticsearch get a random _id. This option allows to use a field in the record as an identifier.

This following record {"name": "Johnny", "request_id": "87d89af7daffad6"} will trigger the following Elasticsearch command

{ "index" : { "_index": "logstash-2013.01.01", "_type": "fluentd", "_id": "87d89af7daffad6" } }
{ "name": "Johnny", "request_id": "87d89af7daffad6" }

Fluentd re-emits events that failed to be indexed/ingested in Elasticsearch with a new and unique _id value, this means that congested Elasticsearch clusters that reject events (due to command queue overflow, for example) will cause Fluentd to re-emit the event with a new _id, however Elasticsearch may actually process both (or more) attempts (with some delay) and create duplicate events in the index (since each have a unique _id value), one possible workaround is to use the fluent-plugin-genhashvalue plugin to generate a unique _hash key in the record of each event, this _hash record can be used as the id_key to prevent Elasticsearch from creating duplicate events.

id_key _hash

Example configuration for fluent-plugin-genhashvalue (review the documentation of the plugin for more details)

<filter logs.**>
  @type genhashvalue
  keys session_id,request_id
  hash_type md5    # md5/sha1/sha256/sha512
  base64_enc true
  base91_enc false
  set_key _hash
  separator _
  inc_time_as_key true
  inc_tag_as_key true
</filter>

โš ๏ธ In order to avoid hash-collisions and loosing data careful consideration is required when choosing the keys in the event record that should be used to calculate the hash

Using nested key

Nested key specifying syntax is also supported.

With the following configuration

id_key $.nested.request_id

and the following nested record

{"nested":{"name": "Johnny", "request_id": "87d89af7daffad6"}}

will trigger the following Elasticsearch command

{"index":{"_index":"fluentd","_type":"fluentd","_id":"87d89af7daffad6"}}
{"nested":{"name":"Johnny","request_id":"87d89af7daffad6"}}

โš ๏ธ Note that Hash flattening may be conflict nested record feature.

parent_key

parent_key a_parent # use "a_parent" field value to set _parent in elasticsearch command

If your input is

{ "name": "Johnny", "a_parent": "my_parent" }

Elasticsearch command would be

{ "index" : { "_index": "****", "_type": "****", "_id": "****", "_parent": "my_parent" } }
{ "name": "Johnny", "a_parent": "my_parent" }

if parent_key is not configed or the parent_key is absent in input record, nothing will happen.

Using nested key

Nested key specifying syntax is also supported.

With the following configuration

parent_key $.nested.a_parent

and the following nested record

{"nested":{ "name": "Johnny", "a_parent": "my_parent" }}

will trigger the following Elasticsearch command

{"index":{"_index":"fluentd","_type":"fluentd","_parent":"my_parent"}}
{"nested":{"name":"Johnny","a_parent":"my_parent"}}

โš ๏ธ Note that Hash flattening may be conflict nested record feature.

routing_key

Similar to parent_key config, will add _routing into elasticsearch command if routing_key is set and the field does exist in input event.

remove_keys

parent_key a_parent
routing_key a_routing
remove_keys a_parent, a_routing # a_parent and a_routing fields won't be sent to elasticsearch

remove_keys_on_update

Remove keys on update will not update the configured keys in elasticsearch when a record is being updated. This setting only has any effect if the write operation is update or upsert.

If the write setting is upsert then these keys are only removed if the record is being updated, if the record does not exist (by id) then all of the keys are indexed.

remove_keys_on_update foo,bar

remove_keys_on_update_key

This setting allows remove_keys_on_update to be configured with a key in each record, in much the same way as target_index_key works. The configured key is removed before indexing in elasticsearch. If both remove_keys_on_update and remove_keys_on_update_key is present in the record then the keys in record are used, if the remove_keys_on_update_key is not present then the value of remove_keys_on_update is used as a fallback.

remove_keys_on_update_key keys_to_skip

retry_tag

This setting allows custom routing of messages in response to bulk request failures. The default behavior is to emit failed records using the same tag that was provided. When set to a value other then nil, failed messages are emitted with the specified tag:

retry_tag 'retry_es'

NOTE: retry_tag is optional. If you would rather use labels to reroute retries, add a label (e.g '@label @SOMELABEL') to your fluent elasticsearch plugin configuration. Retry records are, by default, submitted for retry to the ROOT label, which means records will flow through your fluentd pipeline from the beginning. This may nor may not be a problem if the pipeline is idempotent - that is - you can process a record again with no changes. Use tagging or labeling to ensure your retry records are not processed again by your fluentd processing pipeline.

write_operation

The write_operation can be any of:

Operation Description
index (default) new data is added while existing data (based on its id) is replaced (reindexed).
create adds new data - if the data already exists (based on its id), the op is skipped.
update updates existing data (based on its id). If no data is found, the op is skipped.
upsert known as merge or insert if the data does not exist, updates if the data exists (based on its id).

Please note, id is required in create, update, and upsert scenario. Without id, the message will be dropped.

time_parse_error_tag

With logstash_format true, elasticsearch plugin parses timestamp field for generating index name. If the record has invalid timestamp value, this plugin emits an error event to @ERROR label with time_parse_error_tag configured tag.

Default value is Fluent::ElasticsearchOutput::TimeParser.error for backward compatibility. :: separated tag is not good for tag routing because some plugins assume tag is separated by .. We recommend to set this parameter like time_parse_error_tag es_plugin.output.time.error. We will change default value to . separated tag.

reconnect_on_error

Indicates that the plugin should reset connection on any error (reconnect on next send). By default it will reconnect only on "host unreachable exceptions". We recommended to set this true in the presence of elasticsearch shield.

reconnect_on_error true # defaults to false

with_transporter_log

This is debugging purpose option to enable to obtain transporter layer log. Default value is false for backward compatibility.

We recommend to set this true if you start to debug this plugin.

with_transporter_log true

content_type

With content_type application/x-ndjson, elasticsearch plugin adds application/x-ndjson as Content-Type in payload.

Default value is application/json which is default Content-Type of Elasticsearch requests. If you will not use template, it recommends to set content_type application/x-ndjson.

content_type application/x-ndjson

include_index_in_url

With this option set to true, Fluentd manifests the index name in the request URL (rather than in the request body). You can use this option to enforce an URL-based access control.

include_index_in_url true

http_backend

With http_backend typhoeus, elasticsearch plugin uses typhoeus faraday http backend. Typhoeus can handle HTTP keepalive.

Default value is excon which is default http_backend of elasticsearch plugin.

http_backend typhoeus

http_backend_excon_nonblock

With http_backend_excon_nonblock false, elasticsearch plugin use excon with nonblock=false. If you use elasticsearch plugin with jRuby for https, you may need to consider to set false to avoid follwoing problems.

But for all other case, it strongly reccomend to set true to avoid process hangin problem reported in #732

Default value is true.

http_backend_excon_nonblock false

compression_level

You can add gzip compression of output data. In this case default_compression, best_compression or best speed option should be chosen. By default there is no compression, default value for this option is no_compression

compression_level best_compression

prefer_oj_serializer

With default behavior, Elasticsearch client uses Yajl as JSON encoder/decoder. Oj is the alternative high performance JSON encoder/decoder. When this parameter sets as true, Elasticsearch client uses Oj as JSON encoder/decoder.

Default value is false.

prefer_oj_serializer true

Client/host certificate options

Need to verify Elasticsearch's certificate? You can use the following parameter to specify a CA instead of using an environment variable.

ca_file /path/to/your/ca/cert

Does your Elasticsearch cluster want to verify client connections? You can specify the following parameters to use your client certificate, key, and key password for your connection.

client_cert /path/to/your/client/cert
client_key /path/to/your/private/key
client_key_pass password

If you want to configure SSL/TLS version, you can specify ssl_version parameter.

ssl_version TLSv1_2 # or [SSLv23, TLSv1, TLSv1_1]

โš ๏ธ If SSL/TLS enabled, it might have to be required to set ssl_version.

In Elasticsearch plugin v4.0.2 with Ruby 2.5 or later combination, Elasticsearch plugin also support ssl_max_version and ssl_min_version.

ssl_max_version TLSv1_3
ssl_min_version TLSv1_2

Elasticsearch plugin will use TLSv1.2 as minimum ssl version and TLSv1.3 as maximum ssl version on transportation with TLS. Note that when they are used in Elastissearch plugin configuration, ssl_version is not used to set up TLS version.

If they are not specified in the Elasticsearch plugin configuration, ssl_max_version and ssl_min_version is set up with:

In Elasticsearch plugin v4.0.8 or later with Ruby 2.5 or later environment, ssl_max_version should be TLSv1_3 and ssl_min_version should be TLSv1_2.

From Elasticsearch plugin v4.0.4 to v4.0.7 with Ruby 2.5 or later environment, the value of ssl_version will be used in ssl_max_version and ssl_min_version.

Proxy Support

Starting with version 0.8.0, this gem uses excon, which supports proxy with environment variables - https://github.com/excon/excon#proxy-support

Buffer options

fluentd-plugin-elasticsearch extends Fluentd's builtin Output plugin and use compat_parameters plugin helper. It adds the following options:

buffer_type memory
flush_interval 60s
retry_limit 17
retry_wait 1.0
num_threads 1

The value for option buffer_chunk_limit should not exceed value http.max_content_length in your Elasticsearch setup (by default it is 100mb).

Note: If you use or evaluate Fluentd v0.14, you can use <buffer> directive to specify buffer configuration, too. In more detail, please refer to the buffer configuration options for v0.14

Note: If you use disable_retry_limit in v0.12 or retry_forever in v0.14 or later, please be careful to consume memory inexhaustibly.

Hash flattening

Elasticsearch will complain if you send object and concrete values to the same field. For example, you might have logs that look this, from different places:

{"people" => 100} {"people" => {"some" => "thing"}}

The second log line will be rejected by the Elasticsearch parser because objects and concrete values can't live in the same field. To combat this, you can enable hash flattening.

flatten_hashes true
flatten_hashes_separator _

This will produce elasticsearch output that looks like this: {"people_some" => "thing"}

Note that the flattener does not deal with arrays at this time.

Generate Hash ID

By default, the fluentd elasticsearch plugin does not emit records with a _id field, leaving it to Elasticsearch to generate a unique _id as the record is indexed. When an Elasticsearch cluster is congested and begins to take longer to respond than the configured request_timeout, the fluentd elasticsearch plugin will re-send the same bulk request. Since Elasticsearch can't tell its actually the same request, all documents in the request are indexed again resulting in duplicate data. In certain scenarios, this can result in essentially and infinite loop generating multiple copies of the same data.

The bundled elasticsearch_genid filter can generate a unique _hash key for each record, this key may be passed to the id_key parameter in the elasticsearch plugin to communicate to Elasticsearch the uniqueness of the requests so that duplicates will be rejected or simply replace the existing records. Here is a sample config:

<filter **>
  @type elasticsearch_genid
  hash_id_key _hash    # storing generated hash id key (default is _hash)
</filter>
<match **>
  @type elasticsearch
  id_key _hash # specify same key name which is specified in hash_id_key
  remove_keys _hash # Elasticsearch doesn't like keys that start with _
  # other settings are omitted.
</match>

Sniffer Class Name

The default Sniffer used by the Elasticsearch::Transport class works well when Fluentd has a direct connection to all of the Elasticsearch servers and can make effective use of the _nodes API. This doesn't work well when Fluentd must connect through a load balancer or proxy. The parameter sniffer_class_name gives you the ability to provide your own Sniffer class to implement whatever connection reload logic you require. In addition, there is a new Fluent::Plugin::ElasticsearchSimpleSniffer class which reuses the hosts given in the configuration, which is typically the hostname of the load balancer or proxy. For example, a configuration like this would cause connections to logging-es to reload every 100 operations:

host logging-es
port 9200
reload_connections true
sniffer_class_name Fluent::Plugin::ElasticsearchSimpleSniffer
reload_after 100

Tips

The included sniffer class is not required out_elasticsearch. You should tell Fluentd where the sniffer class exists.

If you use td-agent, you must put the following lines into TD_AGENT_DEFAULT file:

sniffer=$(td-agent-gem contents fluent-plugin-elasticsearch|grep elasticsearch_simple_sniffer.rb)
TD_AGENT_OPTIONS="--use-v1-config -r $sniffer"

If you use Fluentd directly, you must pass the following lines as Fluentd command line option:

sniffer=$(td-agent-gem contents fluent-plugin-elasticsearch|grep elasticsearch_simple_sniffer.rb)
$ fluentd -r $sniffer [AND YOUR OTHER OPTIONS]

Selector Class Name

The default selector used by the Elasticsearch::Transport class works well when Fluentd should behave round robin and random selector cases. This doesn't work well when Fluentd should behave fallbacking from exhausted ES cluster to normal ES cluster. The parameter selector_class_name gives you the ability to provide your own Selector class to implement whatever selection nodes logic you require.

The below configuration is using plugin built-in ElasticseatchFallbackSelector:

hosts exhausted-host:9201,normal-host:9200
selector_class_name "Fluent::Plugin::ElasticseatchFallbackSelector"

Tips

The included selector class is required in out_elasticsearch by default. But, your custom selector class is not required in out_elasticsearch. You should tell Fluentd where the selector class exists.

If you use td-agent, you must put the following lines into TD_AGENT_DEFAULT file:

selector=/path/to/your_awesome_selector.rb
TD_AGENT_OPTIONS="--use-v1-config -r $selector"

If you use Fluentd directly, you must pass the following lines as Fluentd command line option:

selector=/path/to/your_awesome_selector.rb
$ fluentd -r $selector [AND YOUR OTHER OPTIONS]

Reload After

When reload_connections true, this is the integer number of operations after which the plugin will reload the connections. The default value is 10000.

Validate Client Version

When you use mismatched Elasticsearch server and client libraries, fluent-plugin-elasticsearch cannot send data into Elasticsearch. The default value is false.

validate_client_version true

Unrecoverable Error Types

Default unrecoverable_error_types parameter is set up strictly. Because es_rejected_execution_exception is caused by exceeding Elasticsearch's thread pool capacity. Advanced users can increase its capacity, but normal users should follow default behavior.

If you want to increase it and forcibly retrying bulk request, please consider to change unrecoverable_error_types parameter from default value.

Change default value of thread_pool.write.queue_size in elasticsearch.yml: e.g.)

thread_pool.write.queue_size: 1000

Then, remove es_rejected_execution_exception from unrecoverable_error_types parameter:

unrecoverable_error_types ["out_of_memory_error"]

verify_es_version_at_startup

Because Elasticsearch plugin should change behavior each of Elasticsearch major versions.

For example, Elasticsearch 6 starts to prohibit multiple type_names in one index, and Elasticsearch 7 will handle only _doc type_name in index.

If you want to disable to verify Elasticsearch version at start up, set it as false.

When using the following configuration, ES plugin intends to communicate into Elasticsearch 6.

verify_es_version_at_startup false
default_elasticsearch_version 6

The default value is true.

default_elasticsearch_version

This parameter changes that ES plugin assumes default Elasticsearch version. The default value is 5.

custom_headers

This parameter adds additional headers to request. The default value is {}.

custom_headers {"token":"secret"}

api_key

This parameter adds authentication header. The default value is nil.

api_key "ElasticsearchAPIKEY"

Not seeing a config you need?

We try to keep the scope of this plugin small and not add too many configuration options. If you think an option would be useful to others, feel free to open an issue or contribute a Pull Request.

Alternatively, consider using fluent-plugin-forest. For example, to configure multiple tags to be sent to different Elasticsearch indices:

<match my.logs.*>
  @type forest
  subtype elasticsearch
  remove_prefix my.logs
  <template>
    logstash_prefix ${tag}
    # ...
  </template>
</match>

And yet another option is described in Dynamic Configuration section.

Note: If you use or evaluate Fluentd v0.14, you can use builtin placeholders. In more detail, please refer to Placeholders section.

Dynamic configuration

NOTE: out_elasticsearch_dynamic will be planned to be marked as deprecated. Please don't use the new Fluentd configuration. This plugin is maintained for backward compatibility.

If you want configurations to depend on information in messages, you can use elasticsearch_dynamic. This is an experimental variation of the Elasticsearch plugin allows configuration values to be specified in ways such as the below:

<match my.logs.*>
  @type elasticsearch_dynamic
  hosts ${record['host1']}:9200,${record['host2']}:9200
  index_name my_index.${Time.at(time).getutc.strftime(@logstash_dateformat)}
  logstash_prefix ${tag_parts[3]}
  port ${9200+rand(4)}
  index_name ${tag_parts[2]}-${Time.at(time).getutc.strftime(@logstash_dateformat)}
</match>

Please note, this uses Ruby's eval for every message, so there are performance and security implications.

Placeholders

v0.14 placeholders can handle ${tag} for tag, %Y%m%d like strftime format, and custom record keys like as record["mykey"].

Note that custom chunk key is different notations for record_reformer and record_modifier. They uses record["some_key"] to specify placeholders, but this feature uses ${key1}, ${key2} notation. And tag, time, and some arbitrary keys must be included in buffer directive attributes.

They are used as below:

tag

<match my.logs>
  @type elasticsearch
  index_name elastic.${tag} #=> replaced with each event's tag. e.g.) elastic.test.tag
  <buffer tag>
    @type memory
  </buffer>
  # <snip>
</match>

time

<match my.logs>
  @type elasticsearch
  index_name elastic.%Y%m%d #=> e.g.) elastic.20170811
  <buffer tag, time>
    @type memory
    timekey 3600
  </buffer>
  # <snip>
</match>

custom key

records = {key1: "value1", key2: "value2"}
<match my.logs>
  @type elasticsearch
  index_name elastic.${key1}.${key2} # => e.g.) elastic.value1.value2
  <buffer tag, key1, key2>
    @type memory
  </buffer>
  # <snip>
</match>

Multi workers

Since Fluentd v0.14, multi workers feature had been implemented to increase throughput with multiple processes. This feature allows Fluentd processes to use one or more CPUs. This feature will be enabled by the following system configuration:

<system>
  workers N # where N is a natural number (N >= 1).
</system>

log_es_400_reason

By default, the error logger won't record the reason for a 400 error from the Elasticsearch API unless you set log_level to debug. However, this results in a lot of log spam, which isn't desirable if all you want is the 400 error reasons. You can set this true to capture the 400 error reasons without all the other debug logs.

Default value is false.

suppress_doc_wrap

By default, record body is wrapped by 'doc'. This behavior can not handle update script requests. You can set this to suppress doc wrapping and allow record body to be untouched.

Default value is false.

ignore_exceptions

A list of exception that will be ignored - when the exception occurs the chunk will be discarded and the buffer retry mechanism won't be called. It is possible also to specify classes at higher level in the hierarchy. For example

ignore_exceptions ["Elasticsearch::Transport::Transport::ServerError"]

will match all subclasses of ServerError - Elasticsearch::Transport::Transport::Errors::BadRequest, Elasticsearch::Transport::Transport::Errors::ServiceUnavailable, etc.

Default value is empty list (no exception is ignored).

exception_backup

Indicates whether to backup chunk when ignore exception occurs.

Default value is true.

bulk_message_request_threshold

Configure bulk_message request splitting threshold size.

Default value is -1(unlimited).

If you specify this size as negative number, bulk_message request splitting feature will be disabled.

enable_ilm

Enable Index Lifecycle Management (ILM).

Default value is false.

NOTE: This parameter requests to install elasticsearch-xpack gem.

ilm_policy_id

Specify ILM policy id.

Default value is logstash-policy.

NOTE: This parameter requests to install elasticsearch-xpack gem.

ilm_policy

Specify ILM policy contents as Hash.

Default value is {}.

NOTE: This parameter requests to install elasticsearch-xpack gem.

ilm_policies

A hash in the format {"ilm_policy_id1":{ <ILM policy 1 hash> }, "ilm_policy_id2": { <ILM policy 2 hash> }}.

Default value is {}.

NOTE: This parameter requests to install elasticsearch-xpack gem.

ilm_policy_overwrite

Specify whether overwriting ilm policy or not.

Default value is false.

NOTE: This parameter requests to install elasticsearch-xpack gem.

truncate_caches_interval

Specify truncating caches interval.

If it is set, timer for clearing alias_indexes and template_names caches will be launched and executed.

Default value is nil.

use_legacy_template

Use legacy template or not.

For Elasticsearch 7.8 or later, users can specify this parameter as false if their template_file contains a composable index template.

For Elasticsearch 7.7 or older, users should specify this parameter as true.

Composable template documentation is Put Index Template API | Elasticsearch Reference and legacy template documentation is Index Templates | Elasticsearch Reference.

Please confirm that whether the using Elasticsearch cluster(s) support the composable template feature or not when turn on the brand new feature with this parameter.

<metadata> section

Users can specify whether including chunk_id information into records or not:

<match your.awesome.routing.tag>
  @type elasticsearch
  # Other configurations.
  <metadata>
    include_chunk_id true
    # chunk_id_key chunk_id # Default value is "chunk_id".
  </metadata>
</match>

include_chunk_id

Whether including chunk_id for not. Default value is false.

<match your.awesome.routing.tag>
  @type elasticsearch
  # Other configurations.
  <metadata>
    include_chunk_id true
  </metadata>
</match>

chunk_id_key

Specify chunk_id_key to store chunk_id information into records. Default value is chunk_id.

<match your.awesome.routing.tag>
  @type elasticsearch
  # Other configurations.
  <metadata>
    include_chunk_id
    chunk_id_key chunk_hex
  </metadata>
</match>

Configuration - Elasticsearch Input

See Elasticsearch Input plugin document

Configuration - Elasticsearch Filter GenID

See Elasticsearch Filter GenID document

Elasticsearch permissions

If the target Elasticsearch requires authentication, a user holding the necessary permissions needs to be provided.

The set of required permissions are the following:

  "cluster": ["manage_index_templates", "monitor", "manage_ilm"],
  "indices": [
    {
      "names": [ "*" ],
      "privileges": ["write","create","delete","create_index","manage","manage_ilm"]
    }
  ]

These permissions can be narrowed down by:

  • Setting a more specific pattern for indices under the names field
  • Removing the manage_index_templates cluster permission when not using the feature within your plugin configuration
  • Removing the manage_ilm cluster permission and the manage and manage_ilm indices privileges when not using ilm features in the plugin configuration

The list of privileges along with their description can be found in security privileges.

Configuration - Elasticsearch Output Data Stream

Since Elasticsearch 7.9, Data Streams was introduced.

You can enable this feature by specifying @type elasticsearch_data_stream.

@type elasticsearch_data_stream
data_stream_name test

When @type elasticsearch_data_stream is used, unless specified with data_stream_ilm_name and data_stream_template_name or data_stream_ilm_policy, ILM default policy is set to the specified data stream. Then, the matching index template is also created automatically.

data_stream_name

You can specify Elasticsearch data stream name by this parameter. This parameter is mandatory for elasticsearch_data_stream.

data_stream_template_name

You can specify an existing matching index template for the data stream. If not present, it creates a new matching index template.

Default value is data_stream_name.

data_stream_ilm_name

You can specify the name of an existing ILM policy, which will be applied to the data stream. If not present, it creates a new ILM default policy (unless data_stream_template_name is defined, in that case the ILM will be set to the one specified in the matching index template).

Default value is data_stream_name.

There are some limitations about naming rule.

In more detail, please refer to the Path parameters.

data_stream_ilm_policy

You can specify the ILM policy contents as hash. If not present, it will apply the ILM default policy.

NOTE: This parameter requests to install elasticsearch-xpack gem.

data_stream_ilm_policy_overwrite

Specify whether the data stream ILM policy should be overwritten.

Default value is false.

NOTE: This parameter requests to install elasticsearch-xpack gem.

data_stream_template_use_index_patterns_wildcard

Specify whether index patterns should include a wildcard (*) when creating an index template. This is particularly useful to prevent errors in scenarios where index templates are generated automatically, and multiple services with distinct suffixes are in use.

Default value is true.

Consider the following JSON error response when index patterns clash due to wildcard usage:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "index template [eks-kube-apiserver] has index patterns [eks-kube-apiserver*] matching patterns from existing templates [eks-kube-apiserver-audit] with patterns (eks-kube-apiserver-audit => [eks-kube-apiserver-audit*]) that have the same priority [0], multiple index templates may not match during index creation, please use a different priority"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "index template [eks-kube-apiserver] has index patterns [eks-kube-apiserver*] matching patterns from existing templates [eks-kube-apiserver-audit] with patterns (eks-kube-apiserver-audit => [eks-kube-apiserver-audit*]) that have the same priority [0], multiple index templates may not match during index creation, please use a different priority"
  },
  "status": 400
}

Usage Examples

When data_stream_template_use_index_patterns_wildcard is set to true (default):

data_stream_name: foo
data_stream_template_use_index_patterns_wildcard: true

In this case, the resulting index patterns will be: ["foo*"]

When data_stream_template_use_index_patterns_wildcard is set to false:

data_stream_name: foo
data_stream_template_use_index_patterns_wildcard: false

The resulting index patterns will be: ["foo"]

Troubleshooting

See Troubleshooting document

Contact

If you have a question, open an Issue.

Contributing

There are usually a few feature requests, tagged Easy, Normal and Hard. Feel free to work on any one of them.

Pull Requests are welcomed.

Becore send a pull request or report an issue, please read the contribution guideline.

Pull Request Graph

Running tests

Install dev dependencies:

$ gem install bundler
$ bundle install
$ bundle exec rake test
# To just run the test you are working on:
$ bundle exec rake test TEST=test/plugin/test_out_elasticsearch.rb TESTOPTS='--verbose --name=test_custom_template_with_rollover_index_create_and_custom_ilm'

fluent-plugin-elasticsearch's People

Contributors

ashb avatar bitpatty avatar cosmo0920 avatar dependabot[bot] avatar dobesv avatar dterror avatar dterror-zz avatar ethanliou avatar ewolinetz avatar fpytloun avatar gihad avatar hagihala avatar heartsavior avatar ialidzhikov avatar kenhys avatar kenrota avatar kumaravel29 avatar martinssipenko avatar mattheworiordan avatar meetyg avatar pitr avatar repeatedly avatar robertfirek avatar s-silvius avatar se-m avatar sparrowt avatar tanaka-takayoshi avatar wangyuehong avatar xia0pin9 avatar yissacharcw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluent-plugin-elasticsearch's Issues

Json Encoding problems

Hi uken,
when fluentd try to flush some mail logs to your plugins it fails with this message:

2013-12-04 07:30:24 +0100 [warn]: temporarily failed to flush the buffer. next_retry=2013-12-04 07:30:25 +0100 error_class="JSON::GeneratorError" error="source sequence is illegal/malformed utf-8" instance=9518360
  2013-12-04 07:30:24 +0100 [warn]: /var/lib/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.1.4/lib/fluent/plugin/out_elasticsearch.rb:59:in `to_json'

The string to encode is something like "Hai giร  provato..." with lowercase a-grave or other italian characters.

After some investigation i have found that fluentd force encoding to ASCII-8BIT, as consequence when you call to_json method the encoding fail.

To fix it i have changed this line:
bulk_message << meta.to_json
bulk_message << record.to_json

to:
bulk_message << Yajl::Encoder.encode(meta)
bulk_message << Yajl::Encoder.encode(record)

in out_elasticsearch.rb

It's a correct fix?

Thanks!

Why so slow?

I did some tests on a tiny vagrant box with fluentd + elasticsearch by using this plugin.

I seems every log that send to fluentd need roughly 20 sends to write into elasticsearch, compares to write to a file, it just need to few seconds. Sometime even worse.

this is my configuration in fluentd

# Source
<source>
  type forward
  port 24224
</source>

# Output
<match devops.log.**>
  type elasticsearch
  index_name devops
  type_name log
  include_tag_key true
</match>

Am I doing something wrong then there somethings I can to do to improve it?

Or just because the hardware is just too weak?

Pushing the data to ES in integer format .

I am trying to use kibana to search the logs but if data (field) is stored in string format I can not do range comparison. Is there a way to store the content in integer format whenever possible ?

temporarily failed to flush the buffer. next_retry

Trace:

      2014-11-03 09:04:40 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2014-11-03 09:06:42 +0000 error_class="NameError" error="undefined local variable or method `log' for #<Fluent::ElasticsearchOutput:0x007f8daf934c28>" instance=70123258002580
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.6.0/lib/fluent/plugin/out_elasticsearch.rb:66:in `client'
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.6.0/lib/fluent/plugin/out_elasticsearch.rb:164:in `send'
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.6.0/lib/fluent/plugin/out_elasticsearch.rb:157:in `write'
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.41/lib/fluent/buffer.rb:292:in `write_chunk'
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.41/lib/fluent/buffer.rb:272:in `pop'
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.41/lib/fluent/output.rb:305:in `try_flush'
      2014-11-03 09:04:40 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.41/lib/fluent/output.rb:131:in `run'

Config:

<match feedback>
  type elasticsearch
  type_name c_feedback
  logstash_format true
  flush_interval 10s
  host endpoint
  port 9200
  logstash_prefix stats
  include_tag_key true
  id_key request_id
  buffer_type memory
  tag_key for
  num_threads 2
</match>

This issue is existent from version 0.5.1. Tried to upgrade to 0.6.0 in hopes to fix the issue; still no luck.

Setup:
td-agent-1.1.18-0.x86_64
fluent-plugin-elasticsearch version 0.6.0. Although issue existed from version 0.5.1.

Always receive a 400 Bad request when trying to use plugin with Logsene

I'm trying to push logs to an Elasticsearch compatible application called Logsene. See https://sematext.atlassian.net/wiki/display/PUBLOGSENE/Index+Events+via+Elasticsearch+API

The problem is that I always receive a 400 error when pushing using fluent plugin. I can cURL the same log message and it works fine.

I have cloned the repo and build the gem using the latest code from github. I've tried a variety of configurations with and without HTTPS, for example:

<match>
  type elasticsearch
  host logsene-receiver.sematext.com
  port 80
  path /**MYSECRETKEY**/fluentd
  index_name **MYSECRETKEY**
  type_name fluentd
</match>

and

<match>
  type elasticsearch
  hosts http://logsene-receiver.sematext.com:80/**MYSECRETKEY**/fluentd
  index_name **MYSECRETKEY**
  type_name fluentd
</match>

I always get an error like the following:

2014-09-02 21:04:59 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2014-09-02 21:09:39 +0000 error_class="Elasticsearch::Transport::Transport::Errors::BadRequest" error="[400] " instance=70175379032060
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:132:in `__raise_transport_error'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:227:in `perform_request'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/client.rb:92:in `perform_request'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-api-0.4.11/lib/elasticsearch/api/actions/ping.rb:19:in `ping'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.4.0/lib/fluent/plugin/out_elasticsearch.rb:55:in `client'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.4.0/lib/fluent/plugin/out_elasticsearch.rb:138:in `send'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.4.0/lib/fluent/plugin/out_elasticsearch.rb:133:in `write'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-09-02 21:04:59 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'

HTTP and HTTPS auth support

I have a elasticsearch exposed in Internet to be used by kibana.

I have secured elasticsearch with https://github.com/sonian/elasticsearch-jetty

Now, I'm trying to connect this plugin with the elasticsearch.

Following http://rubydoc.info/gems/elasticsearch-transport, I have changed the file out_elasticsearch.rb like this...

diff out_elasticsearch.rb out_elasticsearch.rb.org
11,13d10
<   config_param :user, :string, :default => nil
<   config_param :password, :string, :default => nil
<   config_param :scheme, :string, :default => nil
57c54
<         [{host: @host, port: @port, user: @user, password: @password }]

---
>        [{host: @host, port: @port }]

This proof of concept works

Could you add support for http auth and for ssl scheme?

You prefer a pull request?

Thanks.

"no implicit conversion of nil into String" error

I keep getting these errors in the log file.

2015-01-22 15:27:35 -0800 [warn]: temporarily failed to flush the buffer. next_retry=2015-01-22 15:27:32 -0800 error_class="TypeError" error="no implicit conversion of nil into String" instance=70364703686720
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/patron-0.4.18/lib/patron/session.rb:223:in `handle_request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/patron-0.4.18/lib/patron/session.rb:223:in `request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/adapter/patron.rb:33:in `call'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/elasticsearch-transport-1.0.6/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/elasticsearch-transport-1.0.6/lib/elasticsearch/transport/transport/base.rb:187:in `call'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/elasticsearch-transport-1.0.6/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/elasticsearch-transport-1.0.6/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/elasticsearch-transport-1.0.6/lib/elasticsearch/transport/client.rb:111:in `perform_request'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/elasticsearch-api-1.0.6/lib/elasticsearch/api/actions/ping.rb:19:in `ping'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-elasticsearch-0.7.0/lib/fluent/plugin/out_elasticsearch.rb:62:in `client'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-elasticsearch-0.7.0/lib/fluent/plugin/out_elasticsearch.rb:168:in `send'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-elasticsearch-0.7.0/lib/fluent/plugin/out_elasticsearch.rb:161:in `write'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.55/lib/fluent/buffer.rb:296:in `write_chunk'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.55/lib/fluent/buffer.rb:276:in `pop'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.55/lib/fluent/output.rb:311:in `try_flush'
  2015-01-22 15:27:35 -0800 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.55/lib/fluent/output.rb:132:in `run'

environment:

  • Mac OSX 10.9.5
  • fluentd version 0.10.55
  • fluent-plugin-elasticsearch verson 0.7.0
  • elasticsearch version 1.4.1
  • running on localhost, port 9200
  • a local Logstash instance has no trouble connecting and writing to it over HTTP
  • debug output seems to suggest that file input gets parsed without issues

config

####
## Output descriptions:
##
<match tb.logs>
  type elasticsearch
  host localhost
  port 9200
  logstash_format true
  logstash_prefix fluentd
</match>
...
## File input
## read apache logs continuously and tags td.apache.access
<source>
  type tail
  format apache
  path /Users/tanya/logs
  tag tb.logs
  read_from_head true
</source>

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

error with recently upgraded 0.5.0: the scheme http does not accept registry part: :9200MYHOST1

With the config:

<match this.*>
  type forest
  subtype elasticsearch
  <template>
    buffer_chunk_limit 5m
    buffer_path /var/log/td-agent/buffer/output_${tag}.*
    buffer_queue_limit 1000
    buffer_type file
    flush_interval 2s
    hosts MYHOST1,MYHOST2
    scheme http
    port 9200
    include_tag_key true
    logstash_format true
    logstash_prefix ${tag}
    num_threads 1
    request_timeout 120s
    retry_limit 300
    retry_wait 5s
    tag_key tag
  </template>
</match>

I'm seeing a massive amount of errors...

2014-10-06 21:43:31 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2014-10-07 00:18:27 +0000 error_class="URI::InvalidURIError" error="the scheme http does not accept registry part: :9200MYHOST1 (or bad hostname?)" instance=70105317242240
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/1.9.1/uri/generic.rb:213:in `initialize'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/1.9.1/uri/http.rb:84:in `initialize'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:214:in `new'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:214:in `parse'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:747:in `parse'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/1.9.1/uri/common.rb:994:in `URI'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:246:in `call'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:246:in `URI'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:309:in `url_prefix='
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:77:in `initialize'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:42:in `new'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:42:in `block in __build_connections'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:35:in `map'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:35:in `__build_connections'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:32:in `initialize'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.0/lib/fluent/plugin/out_elasticsearch.rb:47:in `new'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.0/lib/fluent/plugin/out_elasticsearch.rb:47:in `client'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.0/lib/fluent/plugin/out_elasticsearch.rb:161:in `send'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.0/lib/fluent/plugin/out_elasticsearch.rb:154:in `write'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
2014-10-06 21:43:31 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'

Any ideas?

Mapping, tokenization and index

It is rather a question than a bug
Let say i have the following output coming out from stdout

{
"remote": "89.85.14.146",
"city": "saint-hubert"
}

Then, i would like to insert it in ES. However, 'city' field has to be defined as index: 'not_analyzed' in elasticsearch, otherwise it is getting tokenized as 'saint' and 'hubert' which is not my expected behavior.

According to ES documentation

"To create a mapping, you will need the Put Mapping API, or you can add multiple mappings when you create an index."

Ideally, I'd like to do it using fluentd plugin configuration, is it possible ?

get type from record if present, fallback to type_name

I'm storing different logs in elasticsearch and i want to utilize the type-field to separate them so i can have different mappings for each logformat.

I already took care that the _type field is in the record, but this plugin ingnores that and uses the type_name param instead.

Would it be pssoible to first check if there already is a _type field in the record and use this instead of type_name?

No data send to elasticsearch

I want to setup a default chain of applications: fluent/elasticsearch/kibana. However, fluent-plugin-elasticsearch doesn't seem to send any data to elasticsearch. I hope you can help me out.

I'm running Linux Mint (debian based). Elasticsearch/kibana works. I have been able to test that using this information:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html

Which on my system results in:

$ curl -s -XPOST localhost:9200/_bulk --data-binary @requests; echo {"took":434,"errors":false,"items":[{"index":{"_index":"test","_type":"type1","_id":"1","_version":1,"status":201}}]}

I have attached some related config/log files. The fluentd log file is silent (after the startup output), also the elasticsearch.log is silent.

I don't know how to troubleshoot any further, all help is greatly appreciated.

Thanks in advance!

an error in td-agent.log i don't understand related to elasticsearch plugin

2013-08-05 14:19:01 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2013-08-05 14:20:58 +0000 error_class="NoMethodError" error="undefined method `merge!' for #<String:0x007fd766382008>" instance=70281580213200
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.1.2/lib/fluent/plugin/out_elasticsearch.rb:43:in `block in write'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.36/lib/fluent/plugin/buf_memory.rb:62:in `feed_each'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.36/lib/fluent/plugin/buf_memory.rb:62:in `msgpack_each'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.1.2/lib/fluent/plugin/out_elasticsearch.rb:41:in `write'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.36/lib/fluent/buffer.rb:288:in `write_chunk'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.36/lib/fluent/buffer.rb:272:in `pop'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.36/lib/fluent/output.rb:292:in `try_flush'
  2013-08-05 14:19:01 +0000 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.36/lib/fluent/output.rb:119:in `run'

Part of my config (i obfuscated the hostname) :

    <store>
    type elasticsearch
    host ec2-*-*-*-*.compute-1.amazonaws.com
    port 9200
    index_name fluentd
    type_name fluentd
    logstash_format true
    </store>

PS : my config work without the elasticsearch store

Error with Patron gem install

Hi,

When using td-agent, installing fluent-plugin-elasticsearch will fail:

# /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch --no-ri --no-rdoc
Building native extensions.  This could take a while...
ERROR:  Error installing fluent-plugin-elasticsearch:
        ERROR: Failed to build gem native extension.

        /usr/lib64/fluent/ruby/bin/ruby extconf.rb
checking for curl-config... yes
checking for rb_thread_blocking_region()... yes
creating Makefile
......
session_ext.c:727: error: for each function it appears in.)
session_ext.c:730: error: โ€˜CURLPROXY_SOCKS4Aโ€™ undeclared (first use in this function)
session_ext.c:731: error: โ€˜CURLPROXY_SOCKS5_HOSTNAMEโ€™ undeclared (first use in this function)
make: *** [session_ext.o] Error 1

Gem files will remain installed in /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18 for inspection.
Results logged to /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/ext/patron/gem_make.out

I discovered the workaround from here: https://groups.google.com/forum/#!topic/heroku/bjO4EuBg3Y8

Following that, this works:

# /usr/lib64/fluent/ruby/bin/fluent-gem install patron -v0.4.9 --no-ri --no-rdoc
Fetching: patron-0.4.9.gem (100%)
Building native extensions.  This could take a while...
Successfully installed patron-0.4.9
1 gem installed

# /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch --no-ri --no-rdoc
Fetching: elasticsearch-transport-0.4.11.gem (100%)
Fetching: elasticsearch-api-0.4.11.gem (100%)
Fetching: elasticsearch-0.4.11.gem (100%)
Fetching: fluent-plugin-elasticsearch-0.3.0.gem (100%)
Successfully installed elasticsearch-transport-0.4.11
Successfully installed elasticsearch-api-0.4.11
Successfully installed elasticsearch-0.4.11
Successfully installed fluent-plugin-elasticsearch-0.3.0
4 gems installed

Something needs to be fixed here with the patron gem, or a version pegged.

Error 400

Hi, I tried this plugin on the same pc and it works fine, but now I specified an external host and it seems the request are forwarded but the receiver server respond with error 400.

It could be something like:

400 Bad Request
'json' or 'msgpack' parameter is required

# nginx log:
79.16.x.x - - [24/Jul/2013:22:07:05 +0200] "POST /_bulk HTTP/1.1" 400 58 "-" "curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"

mapping

I have loaded a custom mapping in my elasticsearch for index with name logstash*

I have mapped the field pow_1 as float.

{
  "logstash_per_index": {
    "order": 0,
    "template": "logstash*",
    "settings": {
      "index.store.compress.stored": "true",
      "index.cache.field.type": "soft"
    },
    "mappings": {
      "_default_": {
        "_source": {
          "compress": true
        },
        "properties": {
          "@fields": {
            "dynamic": true,
            "path": "full",
            "properties": {
              "errnum": {
                "type": "integer"
              }
            },
            "type": "object"
          },
          "@pow_1": {
            "type": "float"
          },
          "@message": {
            "index": "analyzed",
            "type": "string"
          },
          "@source": {
            "index": "not_analyzed",
            "type": "string"
          },
          "@tags": {
            "index": "not_analyzed",
            "type": "string"
          },
          "@type": {
            "index": "not_analyzed",
            "type": "string"
          },
          "@source_host": {
            "index": "not_analyzed",
            "type": "string"
          },
          "@timestamp": {
            "index": "not_analyzed",
            "type": "date"
          },
          "@source_path": {
            "index": "not_analyzed",
            "type": "string"
          },
        },
        "_all": {
          "enabled": false
        }
      }
    },
    "aliases": {
    }
  }
}

But in indexes I can see two mapping: default (with my mapping) and other one called fluentd.

{
  "logstash-2014.07.24": {
    "mappings": {
      "_default_": {},
      "fluentd": {}
    }
  }
}

And the problem is...

I have two fields in the mapping called fluentd:

@pow_1 as float
pow_1 as string

{
  "logstash-2014.07.24": {
    "mappings": {
      "_default_": {
        "_all": {
          "enabled": false
        },
        "_source": {
          "compress": true
        },
        "properties": {
          "@fields": {
            "dynamic": "true",
            "properties": {
              "errnum": {
                "type": "integer"
              }
            }
          },
          "@message": {
            "type": "string"
          },
          "@pow_1": {
            "type": "float"
          },
          "@source": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@source_host": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@source_path": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@tags": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@timestamp": {
            "type": "date",
            "format": "dateOptionalTime"
          },
          "@type": {
            "type": "string",
            "index": "not_analyzed"
          }
        }
      },
      "fluentd": {
        "_all": {
          "enabled": false
        },
        "_source": {
          "compress": true
        },
        "properties": {
          "@fields": {
            "dynamic": "true",
            "properties": {
              "errnum": {
                "type": "integer"
              }
            }
          },
          "@message": {
            "type": "string"
          },
          "@pow_1": {
            "type": "float"
          },
          "@source": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@source_host": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@source_path": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@tags": {
            "type": "string",
            "index": "not_analyzed"
          },
          "@timestamp": {
            "type": "date",
            "format": "dateOptionalTime"
          },
          "@type": {
            "type": "string",
            "index": "not_analyzed"
          },
          "application": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "host": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "pow_1": {
            "type": "string"
          },
        }
      }
    }
  }
}

Who create this mapping?
Can I change this mapping?
There is a solution for that?

Thanks

Cannot install 0.3.0

Hello,

Trying to install latest version with:

/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch

Getting this error:

ERROR:  Error installing fluent-plugin-elasticsearch:
    ERROR: Failed to build gem native extension.

        /usr/lib64/fluent/ruby/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/lib64/fluent/ruby/bin/ruby
    --with-curl-dir
    --without-curl-dir
    --with-curl-include
    --without-curl-include=${curl-dir}/include
    --with-curl-lib
    --without-curl-lib=${curl-dir}/lib
    --with-curllib
    --without-curllib
extconf.rb:39:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

OS is Amazon Linux.

libcurl is installed:
libcurl-7.33.0-1.41.amzn1.x86_64

No issue with previous version.

What do you guys think?

is @timestamp field works?

Accroding to document, we can use custom time field but is seems not working..

By default, when inserting records in logstash format, @timestamp is dynamically created with the time at log ingestion. If you'd like to use a custom time. Include an @timestamp with your record
{"@timestamp":"2014-04-07T000:00:00-00:00"}

json I posted to fluentd.

{"locale": "kokr", "count": 6, "_type": "dodo.summary.real", "@timestamp": "2014-11-23T000:00:00-00:00", "package": "com.iconnect.launcher.theme.apink"}

but fluent-requested time added to elasticsearch @timestamp field.

Connection timed out

2014-04-23 09:45:27 +0800 [warn]: before_shutdown failed error="Connection timed out - connect(2)"
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `initialize'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `open'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `block in connect'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:763:in `connect'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:745:in `start'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/net/http.rb:1285:in `request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:80:in `perform_request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:39:in `call'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/request/url_encoded.rb:15:in `call'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:187:in `call'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/client.rb:92:in `perform_request'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-api-0.4.11/lib/elasticsearch/api/actions/bulk.rb:81:in `bulk'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.0/lib/fluent/plugin/out_elasticsearch.rb:96:in `send'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.0/lib/fluent/plugin/out_elasticsearch.rb:91:in `write'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/buffer.rb:276:in `pop'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/plugin/buf_memory.rb:87:in `block in before_shutdown'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/plugin/buf_memory.rb:83:in `before_shutdown'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:382:in `before_shutdown'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:152:in `block in run'
  2014-04-23 09:45:27 +0800 [warn]: <internal:prelude>:10:in `synchronize'
  2014-04-23 09:45:27 +0800 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:151:in `run'

content-type in Net::HTTP::Post

Hi uken,
when sending json data to elasticsearch like this:

request = Net::HTTP::Post.new("/_bulk")

Net::HTTP library try to escape request body and so elasticsearch sometime receive non utf-8 data and log a org.elasticsearch.common.jackson.core.JsonParseException

To fix this i have added content-type and charset to the Post call:

request = Net::HTTP::Post.new("/_bulk",{"content-type"=>"application/json; charset=utf-8"})

Bye,
Luigi

Does fluent-plugin-elasticsearch convert to UTF-8 before creating json?

I have an error with sending some data to elasitcsearch using this plugin, some examples of the error:

Caused by: org.elasticsearch.common.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xa3
Caused by: org.elasticsearch.common.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x6d
Caused by: org.elasticsearch.common.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x20

From the research I have done ( http://stackoverflow.com/questions/13830346/jackson-json-parser-invalid-utf-8-start-byte ; http://stackoverflow.com/questions/24629013/jmeter-invalid-utf-8-middle-byte ) it could be that the json being sent by the plugin is not UTF-8 - and json should always bt URD-8 which I am sure you know.

Could you confirm that fluent-plugin-elasticsearch converts to UTF-8 before crafting the json request?

Thanks.

Specify ElasticSearch index template

I'm using fluentd with the in_syslog plugin and elasticsearch plugin to get syslog into elasticsearch, with a kibana frontend.

One of the problems I'm having though, is that the fields are indexed in elasticsearch so when I add a terms dashboard in kibana to give me, say, the top-10 hostnames, hostnames with dashes in them are broken up. so mysql-test-01 would come across as three hostnames: mysql, test, and 01.

Logstash got around this issue by making a "raw" version of several fields that is set to not-analyzed upon creation, so that you can run your dashboards against that instead.

More information here: http://www.elasticsearch.org/blog/logstash-1-3-1-released/

With syslog messages going into ES with this plugin, I'm finding that I'd like to have a "raw" or non-analyzed host (hostname) field and ident field (gives me the application). Unfortunately right now both of those fields are analyzed and it's messing with our dashboards.

type_name based on tag_key

I have a match pattern: traffic.**, so it matches traffic.logs and traffic.metrics

It would be nice to set the type_name to logs or metrics ....

setup on local host

I am setting up fluentd and elasticsearch on a local VM in order to try the fluentd and ES stack.

OS: centos (recent)

[root@localhost data]# cat /etc/redhat-release 
CentOS release 6.5 (Final)

I am elasticsearch up and running on localhost (I used it with logstash with no issue)

[root@localhost data]# curl -X GET http://localhost:9200/
{
  "status" : 200,
  "name" : "Simon Williams",
  "version" : {
    "number" : "1.2.1",
    "build_hash" : "6c95b759f9e7ef0f8e17f77d850da43ce8a4b364",
    "build_timestamp" : "2014-06-03T15:02:52Z",
    "build_snapshot" : false,
    "lucene_version" : "4.8"
  },
  "tagline" : "You Know, for Search"
}

I have installed td-agent following the installation notes from fluentd website.
I am using that configuration file:

<source>
  type tail
  path /tmp/data/log
  pos_file /tmp/data/log.pos
  format /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[\
^\"]*)" "(?<agent>[^\"]*)")?/
  time_format %d/%b/%Y:%H:%M:%S %z
  tag front.nginx.access
</source>

<match front.nginx.access>
  type elasticsearch
  host localhost
  port 9200
  index_name fluentd
  type_name nginx
  include_tag_key

  # buffering                                                                                                                                                
  buffer_type file
  buffer_path /tmp/fluentd/buffer/
  flush_interval 10s
  buffer_chunk_limit 16m
  buffer_queue_limit 4096
  retry_wait 15s
</match>

Here is the start-up log:

2014-07-24 13:39:58 +0200 [info]: starting fluentd-0.10.50
2014-07-24 13:39:58 +0200 [info]: reading config file path="/etc/td-agent/td-agent.conf"
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-mixin-config-placeholders' version '0.2.4'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-elasticsearch' version '0.3.1'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-flume' version '0.1.1'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-mongo' version '0.7.3'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-parser' version '0.3.4'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '1.4.1'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-s3' version '0.4.0'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-scribe' version '0.10.10'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-td' version '0.10.20'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-td-monitoring' version '0.1.2'
2014-07-24 13:39:58 +0200 [info]: gem 'fluent-plugin-webhdfs' version '0.2.2'
2014-07-24 13:39:58 +0200 [info]: gem 'fluentd' version '0.10.50'
2014-07-24 13:39:58 +0200 [info]: using configuration file: <ROOT>
  <source>
    type tail
    path /tmp/data/log
    pos_file /tmp/data/log.pos
    format /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?/
    time_format %d/%b/%Y:%H:%M:%S %z
    tag front.nginx.access
  </source>
  <match front.nginx.access>
    type elasticsearch
    host localhost
    port 9200
    index_name fluentd
    type_name nginx
    include_tag_key 
    buffer_type file
    buffer_path /tmp/fluentd/buffer/
    flush_interval 10s
    buffer_chunk_limit 16m
    buffer_queue_limit 4096
    retry_wait 15s
  </match>
</ROOT>
2014-07-24 13:39:58 +0200 [info]: adding source type="tail"
2014-07-24 13:39:58 +0200 [info]: adding match pattern="front.nginx.access" type="elasticsearch"
2014-07-24 13:39:58 +0200 [info]: following tail of /tmp/data/log

I get that error:

2014-07-24 13:40:00 +0200 [warn]: temporarily failed to flush the buffer. next_retry=2014-07-24 13:40:13 +0200 error_class="Elasticsearch::Transport::Transport::Errors::ServiceUnavailable" error="[503] " instance=70247139359260
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:132:in `__raise_transport_error'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:227:in `perform_request'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/client.rb:92:in `perform_request'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-api-0.4.11/lib/elasticsearch/api/actions/ping.rb:19:in `ping'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.1/lib/fluent/plugin/out_elasticsearch.rb:46:in `client'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.1/lib/fluent/plugin/out_elasticsearch.rb:103:in `send'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.1/lib/fluent/plugin/out_elasticsearch.rb:98:in `write'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-07-24 13:40:00 +0200 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'

running tcpdump on port 9200, I get nothing...

tcpdump -x -X -i any 'port 9200'

ClassCastException

So I am using dstat plugin to get the system data and then use the elasticsearch plugin to put it in to elasticsearch then use Kibana to visualize it. The issue I am having is that when I am trying to plot the value of dstat.total cpu usage.hiq or any of the dstat.total.* they come up as String. I checked my _mappings and they came out all as string.

{
  "logstash-2015.02.05" : {
    "mappings" : {
      "fluentd" : {
        "properties" : {
          "@timestamp" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },
          "dstat" : {
            "properties" : {
              "dsk/total" : {
                "properties" : {
                  "read" : {
                    "type" : "string"
                  },
                  "writ" : {
                    "type" : "string"
                  }
                }
              },
              "net/total" : {
                "properties" : {
                  "recv" : {
                    "type" : "string"
                  },
                  "send" : {
                    "type" : "string"
                  }
                }
              },
              "total cpu usage" : {
                "properties" : {
                  "hiq" : {
                    "type" : "string"
                  },
                  "idl" : {
                    "type" : "string"
                  },
                  "siq" : {
                    "type" : "string"
                  },
                  "sys" : {
                    "type" : "string"
                  },
                  "usr" : {
                    "type" : "string"
                  },
                  "wai" : {
                    "type" : "string"
                  }
                }
              }
            }
          },
          "hostname" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

The error from Elasticsearch that I am having is,

ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]

How can I define custom mappings ?

fluent-plugin-elasticsearch, geoip, typecast Together and slowใ€‚

hi uken:
I find the data is so slow show in elasticsearch-head when I uses fluent-plugin-elasticsearch, geoip, typecast. my config file is:

<source>
  type tail
  path /opt/realtimesearch/elasticsearch-0.90.5/s3log/access/clickstream-access.log
  pos_file /opt/realtimesearch/elasticsearch-0.90.5/s3log/access/clickstream-access.log.pos
  tag geoip.access
  format /^(?<remote_intranet>([0-9a-z\.,\s\%20]*,(\%20|\s)*)*)(?<remote_internet>[0-9a-z\. ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*) "(?<referer>[^\"]*)" "(?<agent>[^\"]*)" (?<uid_set>[^ ]*) (?<uid_got>[^ ]*) (?<customer_id_cookie>[^ ]*) (?<ga_cookie>[^ ]*) (?<request_time>[^ ]*) (?<cookie_TestType>[^ ]*) (?<ABTest>[^ ]*)$/
  time_format %d/%b/%Y:%H:%M:%S %z
</source>

<match geoip.access>
    type geoip
    geoip_lookup_key         remote_internet
    enable_key_city          geoip_city
    enable_key_latitude      geoip_lat
    enable_key_longitude     geoip_lon
    enable_key_country_code  geoip_country
    enable_key_region        geoip_region
    remove_tag_prefix    geoip.access
    add_tag_prefix       typecast.access
    flush_interval       1s
</match>

<match typecast.access>
  type typecast
  item_types code:integer,size:integer,request_time:float
  prefix es
</match>

<match es.typecast.access>
  type elasticsearch
  host 127.0.0.1
  port 9200
  logstash_prefix logstash
  logstash_format true
  type_name fluentd
  index_name fluentd
  flush_interval 5s
</match>

if I want to use Buffer Plugin, How can I do, you can give me an example in my config file. I don't known buffer plugin is before or after <match es.typecast.access> Thanks!

error_class="ThreadError" error="current thread not owner"

Problem:

Fluentd setup seems to work just fine, except data is only flushed to elasticsearch when the fluentd service is restarted. I tried with ruby 1.9 and 2.0, same results. The next_retry field in the logs suggests that the worker thread(s) for flushing do not execute until SIGHUP is recieved by fluentd.
The whole setup is running in docker containers.

Only thing i could find related to the problem is: http://stackoverflow.com/questions/24701230/fluentd-does-not-flush-any-data-to-elastic-search-but-does-flush-upon-shutdown

Versions i tried it with:

ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]

Config:

<source>
    type tail
    format json
    time_key time
    time_format %Y-%m-%dT%T.%LZ
    path /var/lib/docker/containers/4c8e53463ec86870aeb1694bf0255c78315b0274d582524a30f43b4bc7553ed1/4c8e53463ec86870aeb1694bf0255c78315b0274d582524a30f43b4bc7553ed1-json.log
    pos_file /var/lib/docker/containers/4c8e53463ec86870aeb1694bf0255c78315b0274d582524a30f43b4bc7553ed1/4c8e53463ec86870aeb1694bf0255c78315b0274d582524a30f43b4bc7553ed1-json.log.pos
    tag docker.container.elasticsearch
    rotate_wait 5
    read_from_head true
  </source>
  <match docker.container.collector>
    type elasticsearch
    host es1
    port 9200
    index_name fluentd
    type_name collector
    logstash_format true
    request_timeout 15s
    flush_interval 3s
    retry_limit 17
    retry_wait 1s
  </match>

-vv Log from SIGHUP until restart:

2014-10-08 13:47:42 +0000 [info]: plugin/in_tail.rb:475:initialize: following tail of /var/lib/docker/containers/4c8e53463ec86870aeb1694bf0255c78315b0274d582524a30f43b4bc7553ed1/4c8e53463ec86870aeb1694bf0255c78315b0274d582524a30f43b4bc7553ed1-json.log
2014-10-08 13:48:49 +0000 [debug]: fluent/supervisor.rb:306:block in install_supervisor_signal_handlers: fluentd supervisor process get SIGHUP
2014-10-08 13:48:49 +0000 [info]: fluent/supervisor.rb:307:block in install_supervisor_signal_handlers: restarting
2014-10-08 13:48:49 +0000 [debug]: fluent/supervisor.rb:432:block in install_main_process_signal_handlers: fluentd main process get SIGTERM
2014-10-08 13:48:49 +0000 [debug]: fluent/supervisor.rb:435:block in install_main_process_signal_handlers: getting start to shutdown main process
2014-10-08 13:48:49 +0000 [info]: fluent/engine.rb:237:run: shutting down fluentd
2014-10-08 13:48:49 +0000 [warn]: fluent/output.rb:344:rescue in try_flush: temporarily failed to flush the buffer. next_retry=2014-10-08 13:47:47 +0000 error_class="ThreadError" error="current thread not owner" instance=28378900
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/1.9.1/monitor.rb:246:in `mon_check_owner'
2014-10-08 13:48:49 +0000 [warn]: fluent/output.rb:344:rescue in try_flush: temporarily failed to flush the buffer. next_retry=2014-10-08 13:47:47 +0000 error_class="ThreadError" error="current thread not owner" instance=28391600
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/1.9.1/monitor.rb:195:in `mon_exit'
2014-10-08 13:48:49 +0000 [warn]: fluent/output.rb:344:rescue in try_flush: temporarily failed to flush the buffer. next_retry=2014-10-08 13:47:47 +0000 error_class="ThreadError" error="current thread not owner" instance=28476300
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/1.9.1/monitor.rb:246:in `mon_check_owner'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:123:in `ensure in require'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:123:in `require'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/1.9.1/monitor.rb:195:in `mon_exit'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:254:in `default_uri_parser'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:246:in `URI'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:123:in `ensure in require'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:309:in `url_prefix='
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/1.9.1/monitor.rb:246:in `mon_check_owner'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:123:in `require'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:77:in `initialize'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/1.9.1/monitor.rb:195:in `mon_exit'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:254:in `default_uri_parser'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:43:in `new'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:123:in `ensure in require'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:246:in `URI'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:43:in `block in __build_connections'
  2014-10-08 13:48:49 +0000 [warn]: /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:123:in `require'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:309:in `url_prefix='
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `map'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:254:in `default_uri_parser'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:77:in `initialize'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `__build_connections'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/utils.rb:246:in `URI'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:43:in `new'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/base.rb:32:in `initialize'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:309:in `url_prefix='
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:43:in `block in __build_connections'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:47:in `new'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:77:in `initialize'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `map'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:47:in `client'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:43:in `new'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `__build_connections'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:161:in `send'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:43:in `block in __build_connections'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/base.rb:32:in `initialize'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:154:in `write'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `map'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:47:in `new'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:36:in `__build_connections'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:47:in `client'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:276:in `pop'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.5/lib/elasticsearch/transport/transport/base.rb:32:in `initialize'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:161:in `send'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:311:in `try_flush'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:47:in `new'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:154:in `write'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:132:in `run'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:47:in `client'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:296:in `write_chunk'
2014-10-08 13:48:49 +0000 [warn]: fluent/output.rb:385:rescue in before_shutdown: before_shutdown failed error="current thread not owner"
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:161:in `send'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:276:in `pop'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.5.1/lib/fluent/plugin/out_elasticsearch.rb:154:in `write'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:311:in `try_flush'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:132:in `run'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/buffer.rb:276:in `pop'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:311:in `try_flush'
  2014-10-08 13:48:49 +0000 [warn]: /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/output.rb:132:in `run'
2014-10-08 13:48:49 +0000 [info]: plugin/out_elasticsearch.rb:63:client: Connection opened to Elasticsearch cluster => {:host=>"es1", :port=>9200, :scheme=>"http"}
2014-10-08 13:48:50 +0000 [info]: plugin/out_elasticsearch.rb:63:client: Connection opened to Elasticsearch cluster => {:host=>"es1", :port=>9200, :scheme=>"http"}
/usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/engine.rb:298:in `join': deadlock detected (fatal)
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/engine.rb:298:in `block in shutdown'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/engine.rb:288:in `each'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/engine.rb:288:in `shutdown'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/engine.rb:238:in `run'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:464:in `run_engine'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:135:in `block in start'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:250:in `call'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:250:in `main_process'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:225:in `block in supervise'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:224:in `fork'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:224:in `supervise'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/supervisor.rb:128:in `start'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/lib/fluent/command/fluentd.rb:160:in `<top (required)>'
        from /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:53:in `require'
        from /usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:53:in `require'
        from /usr/local/lib64/ruby/gems/1.9.1/gems/fluentd-0.10.53/bin/fluentd:6:in `<top (required)>'
        from /usr/local/bin/fluentd:23:in `load'
        from /usr/local/bin/fluentd:23:in `<main>'
2014-10-08 13:48:50 +0000 [info]: fluent/supervisor.rb:240:supervise: process finished code=256
2014-10-08 13:48:50 +0000 [error]: fluent/supervisor.rb:138:start: fluentd main process died unexpectedly. restarting.
2014-10-08 13:48:50 +0000 [info]: fluent/supervisor.rb:223:supervise: starting fluentd-0.10.53

Time of creating new index is wrong.

Hi,

I use td-agent to receive log from nginx, then forward to ES. Here is my td-agent.conf :

<source>
  type forward
  port 24224
  bind 0.0.0.0
</source>

<match access>
  type elasticsearch
  host 10.92.0.4
  port 9200
  logstash_format true
</match>

And here is my indexes :

#ls -al 
drwxr-xr-x 8 elasticsearch elasticsearch 4096 Oct  6 06:58 logstash-2013.10.06
drwxr-xr-x 8 elasticsearch elasticsearch 4096 Oct  7 06:58 logstash-2013.10.07
drwxr-xr-x 8 elasticsearch elasticsearch 4096 Oct  8 06:59 logstash-2013.10.08
drwxr-xr-x 8 elasticsearch elasticsearch 4096 Oct  9 06:58 logstash-2013.10.09
drwxr-xr-x 8 elasticsearch elasticsearch 4096 Oct 10 06:58 logstash-2013.10.10

Everything works fine, but the time of creating the each new index is not correct, I think it should be at 00:00 or 00:01 ( begining of a day ). These indexes were creating almost at 06:58 or 06:59.

My timezone is GMT+07.

The nginx servers have lot of users visiting for all the time. I am sure that there's always logging event at 00:00 and later.

How could I fix this ? I've read the Doc but found nothing about this ?

Hope you can show me the correct way.

BRs.

Impossible to install on CentOS7

Trying to install the plugin on a CentOS7 box, I end up with the following trace

[root@td ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
[root@td ~]# uname -a
Linux td 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@td ~]# ruby --version
ruby 2.0.0p353 (2013-11-22) [x86_64-linux]
[root@td ~]# gem --version
2.0.14
[root@td ~]# rpm -qa | grep -e curl -e openssl
openssl-libs-1.0.1e-34.el7_0.3.x86_64
openssl-devel-1.0.1e-34.el7_0.3.x86_64
libcurl-7.29.0-19.el7.x86_64
python-pycurl-7.19.0-17.el7.x86_64
openssl-1.0.1e-34.el7_0.3.x86_64
curl-7.29.0-19.el7.x86_64
libcurl-devel-7.29.0-19.el7.x86_64
[root@td ~]# /opt/td-agent/embedded/bin/fluent-gem install fluent-plugin-elasticsearch
Building native extensions.  This could take a while...
ERROR:  Error installing fluent-plugin-elasticsearch:
        ERROR: Failed to build gem native extension.

    /opt/td-agent/embedded/bin/ruby extconf.rb
checking for curl-config... yes
checking for rb_thread_blocking_region()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/td-agent/embedded/bin/ruby
        --with-curl-dir
        --without-curl-dir
        --with-curl-include
        --without-curl-include=${curl-dir}/include
        --with-curl-lib
        --without-curl-lib=${curl-dir}/lib
/opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
       from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
        from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
       from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:742:in `try_func'
        from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:1027:in `block in have_func'
       from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
        from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
       from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
       from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
       from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
        from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:1026:in `have_func'
       from extconf.rb:47:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/patron-0.4.18 for inspection.
Results logged to /opt/td-agent/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/patron-0.4.18/gem_make.out
[root@td ~]#

cannot install on AWS EC2

Hey,
I need some help on why it failed to install the plugin. Below is the print out, and your help is very much appreciated.

[root@ip-10-178-115-44 td-agent]# /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch
Building native extensions.  This could take a while...
ERROR:  Error installing fluent-plugin-elasticsearch:
    ERROR: Failed to build gem native extension.

        /usr/lib64/fluent/ruby/bin/ruby extconf.rb
checking for curl-config... yes
checking for rb_thread_blocking_region()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/lib64/fluent/ruby/bin/ruby
    --with-curl-dir
    --without-curl-dir
    --with-curl-include
    --without-curl-include=${curl-dir}/include
    --with-curl-lib
    --without-curl-lib=${curl-dir}/lib
/usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
    from extconf.rb:47:in `<main>'


Gem files will remain installed in /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18 for inspection.
Results logged to /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/ext/patron/gem_make.out

Target index does not use the @timestamp property present in the record

If logstash_format is true, target index's date is computed by looking at the current time rather than the @timestamp property of the document. This creates a problem when the current day according to the document's @timestamp differs from the current time's day.

For example, if the document's timestamp is 2014-09-22T22:59:00Z and the record was sent to fluentd on 2014-09-23T00:01:00Z, the index will be index-name-2014.09.23 which is incorrect. The target index's date should be computed from the document's timestamp (if available).

Need to pass timeout parameter to Patron adapter to avoid duplicate records in elasticsearch

Default timeout value in /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/lib/patron/session.rb is 5 seconds, but sometimes it's not enough to completely read bulk response from elasticseach and log data records sent to elasticsearch again and again. It leads to appearance a duplicate records in elasticsearch.

2014-07-01 16:35:23 +0400 [warn]: temporarily failed to flush the buffer. next_retry=2014-07-01 16:34:33 +0400 error_class="Faraday::TimeoutError" error="Operation timed out after 5000 milliseconds with 0 bytes received" instance=70263784889780
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/lib/patron/session.rb:223:in `handle_request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/lib/patron/session.rb:223:in `request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/adapter/patron.rb:33:in `call'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.2/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.2/lib/elasticsearch/transport/transport/base.rb:187:in `call'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.2/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.2/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-1.0.2/lib/elasticsearch/transport/client.rb:102:in `perform_request'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-api-1.0.2/lib/elasticsearch/api/actions/bulk.rb:91:in `bulk'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.0/lib/fluent/plugin/out_elasticsearch.rb:102:in `send'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.0/lib/fluent/plugin/out_elasticsearch.rb:90:in `write'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/buffer.rb:276:in `pop'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:310:in `try_flush'
  2014-07-01 16:35:23 +0400 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.45/lib/fluent/output.rb:132:in `run'

more information in connection error log

recently i receive fluent log message, but it can't display host or port information.

my elasticsearch server use cluster(6 server), i don't know which server has a problem.

cluster don't have a problem, when i restart fluent it works.

td-agent.conf

<match apache.access>
  type elasticsearch
  hosts x.x.x.x:10200,x.x.x.y:10200,x.x.x.z:10200,x.x.x.a:10200,x.x.x.b:10200,x.x.x.c:10200
  type_name access-log
  logstash_format true
  logstash_prefix logstash
  utc_index false
  request_timeout 20s

  # buffer
  buffer_type file
  buffer_path /var/log/td-agent/buffer/apache-access-elasticsearch.*.buffer
  buffer_chunk_limit 8m
  buffer_queue_limit 10000
  flush_interval 60
  retry_limit 17
</match>

fluent log

2014-08-12 07:53:45 +0900 [warn]: temporarily failed to flush the buffer. next_retry=2014-08-12 10:17:52 +0900 error_class="Faraday::ConnectionFailed" error="couldn't connect to host" instance=69894834792040
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/lib/patron/session.rb:223:in `handle_request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18/lib/patron/session.rb:223:in `request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/adapter/patron.rb:33:in `call'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:187:in `call'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-transport-0.4.11/lib/elasticsearch/transport/client.rb:92:in `perform_request'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/elasticsearch-api-0.4.11/lib/elasticsearch/api/actions/ping.rb:19:in `ping'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.4.0/lib/fluent/plugin/out_elasticsearch.rb:50:in `client'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.4.0/lib/fluent/plugin/out_elasticsearch.rb:108:in `send'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.4.0/lib/fluent/plugin/out_elasticsearch.rb:103:in `write'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-08-12 07:53:45 +0900 [warn]: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'

Use Fluentd Tag as _type

Are you able to configure the plugin to grab the Tag used in Fluentd to be used as the type passed to ElasticSearch?

Example:

<match my.logs>
  type elasticsearch
  logstash_format true
  include_tag_key true
  tag_key _type
</match>

The record inserted into elasticsearch would be:

{
"_index" : "logstash-2014.07.10",
"_type" : "my.logs",
"_id" : "G3He_H6qShdsfa2Zx5NAzbw",
"_source": {"message":"This is a Test"}
}

custom timestamp format - millisecs are down to 0

Hi,
I'm trying to insert custom @timestamp value into records, but need to use milliseconds, so using this format - "@timestamp":"2014-05-16T10:43:52.207-04:00", but then in kibana it's shown without milliseconds (just as 10:43:52.000).

Checked mappings:

          "@timestamp" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },

so instead of dateOptionalTime there should be dateTime (as in http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-date-format.html) ..

any idea?
Thanks

Allow daily splitting of index even if not logstash

I might be using fluentd to pass some json-formatted data to ES, but it's definitely not in syslog/logstash format (wouldn't make any sense anyway)

So I did a quick hack to allow splitting, would be nice if this was done in more ...adjustable way. I don't want indexes split at UTC but other people might:

    config_param :split_daily, :bool, :default => false

    if @split_daily
      target_index = @index_name + Time.at(time).strftime("%Y-%m-%d")
    else
    target_index = @index_name
    end

specify multiple elasticsearch hosts

It should be able to push to multiple elasticsearch server similar to the default

<server>
   host elasticsearch1
</server>
<server>
   host elasticsearch1
</server>

Sending logs silently dies

I have following configuration:

<match apache.**>
  type elasticsearch
  logstash_format true
  host my-es-host.com
  port 80
  index_name fluentd
  type_name fluentd
  logstash_prefix apache
  buffer_chunk_limit 10m
  buffer_queue_limit 64
  flush_interval 5s
</match>

For some reason sometimes it just stops sending any apache logs to my ES cluster, without any errors or anything. After I restart fluentd it works fine again, but I expect now it to fail again.

Is there any way to debug such situations? Any proposals why it happens at all?

Feature: Allow setting of transport timeout

It looks to me like there's no way to override the default transport (patron) timeout (5s). Assuming I'm not overlooking this, or a clever way to do it without modifying your plugin, I think this would mean adding a config option and passing it to your call to Elasticsearch::Client.new to include something like:

transport_options: { request: { timeout: @timeout } }

What do you think? Apologies if I'm just overlooking a way to set this some other way.

Thanks.

Plugin locks up completely when accidentally sending a string log message

Hi, I had some buggy code which was sending preformatted strings (rather than a json dict) to td-agent. td-agent was fine with this, but a single bad message causes the elasticsearch plugin to stop logging anything: basically causes our sitewide central logging system to never log anything again until td-agent is restarted.

Just needs a spot of exception handling I guess. If you need more information, just say!

Log trace:

2014-07-06 09:46:58 +0000 [warn]: temporarily failed to flush the buffer. next_retry=2014-07-06 14:53:37 +0000 error_class="NoMethodError" error="undefined method `has_key?' for #<String:0x007f3d74cb6390>" instance=69951065878960
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.1/lib/fluent/plugin/out_elasticsearch.rb:71:in `block in write'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/plugin/buf_memory.rb:62:in `feed_each'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/plugin/buf_memory.rb:62:in `msgpack_each'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-plugin-elasticsearch-0.3.1/lib/fluent/plugin/out_elasticsearch.rb:69:in `write'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:296:in `write_chunk'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/buffer.rb:276:in `pop'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:310:in `try_flush'
  2014-07-06 09:46:58 +0000 [warn]: /usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.50/lib/fluent/output.rb:132:in `run'

(there are later log traces where it continues to try to process the same message every hour or so, failing each time)

No data send to elasticsearch

I want to setup a default chain of applications: fluent/elasticsearch/kibana. However, fluent-plugin-elasticsearch doesn't seem to send any data to elasticsearch. I hope you can help me out.

I'm running Linux Mint (debian based). Elasticsearch/kibana works. I have been able to test that using this information:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html

Which on my system results in:

$ curl -s -XPOST localhost:9200/_bulk --data-binary @requests; echo

{"took":434,"errors":false,"items":[{"index":{"_index":"test","_type":"type1","_id":"1","_version":1,"status":201}}]}

And the following in elasticsearch.log:

[2014-09-08 09:09:26,472][DEBUG][cluster.service ] [Karl Malus] processing [update-mapping [test][type1] / node [RlqapoBORZGN9ZJPhAfgXA], order [1]]: execute
[2014-09-08 09:09:26,478][DEBUG][cluster.metadata ] [Karl Malus] [test] update_mapping type1 with source [{"type1":{"properties":{"field1":{"type":"string"}}}}]
[2014-09-08 09:09:26,479][DEBUG][cluster.service ] [Karl Malus] cluster state updated, version [10], source [update-mapping [test][type1] / node [RlqapoBORZGN9ZJPhAfgXA], order [1]]
[2014-09-08 09:09:26,479][DEBUG][cluster.service ] [Karl Malus] publishing cluster state version 10
[2014-09-08 09:09:26,480][DEBUG][cluster.service ] [Karl Malus] set local cluster state to version 10
[2014-09-08 09:09:26,481][DEBUG][river.cluster ] [Karl Malus] processing [reroute_rivers_node_changed]: execute
[2014-09-08 09:09:26,481][DEBUG][river.cluster ] [Karl Malus] processing [reroute_rivers_node_changed]: no change in cluster_state
[2014-09-08 09:09:26,486][DEBUG][cluster.service ] [Karl Malus] processing [update-mapping [test][type1] / node [RlqapoBORZGN9ZJPhAfgXA], order [1]]: done applying updated cluster_state (version: 10)
[2014-09-08 09:09:26,486][DEBUG][cluster.action.index ] [Karl Malus] successfully updated master with mapping update: index [test], indexUUID [dT30Z6KjSWy6yvZ38491kg], type [type1] and source [{"type1":{"properties":{"field1":{"type":"string"}}}}]

And also data is shown in Kibana.

My fluent.conf:

Read Apache access log

type tail #format apache2 format /^(?[^:]+):(?[[:digit:]]+) (?[^ ]+) -(?[^-]+)- [(?[^]]+)] "(?[[:alpha:]]+) (?[^ ]+) (?[^ ]+)" (?[[:digit:]]+) (?[[:digit:]]_) "(?[^\"]_)" "(?[^\"]+)"?$/ time_format %d/%b/%Y:%H:%M:%S %z path /var/log/apache2/other_vhosts_access.log pos_file /var/log/fluentd/local_apache_access.pos tag local.apache.access # Send everything to elasticsearch # https://github.com/uken/fluent-plugin-elasticsearch

<match **>
type copy

type elasticsearch
host 127.0.0.1
port 9200
#index_name fluentd
#type_name fluentd
#logstash_format true
#logstash_prefix mylogs
#logstash_dateformat %Y.%m.%d
#utc_index false
#request_timeout 5s
#include_tag_key true
#tag_key tag
#id_key request_id
#buffer_type memory
#flush_interval 60
#retry_limit 17
#retry_wait 1.0
#num_threads 1


type file
path /var/log/fluentd/fluentd.dmp

And the fluentd.dmp file contains:

2014-09-08T09:09:46+02:00 local.apache.access {"hostname":"thinkpad","port":"80","hostip":"127.0.0.1","user":" ","method":"GET","path":"/kibana-3.1.0/config.js","httpversion":"HTTP/1.1","returncode":"200","responsesize":"1296","referer":"http://127.0.0.1/kibana-3.1.0/index.html","agent":"Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"}
2014-09-08T09:09:46+02:00 local.apache.access {"hostname":"thinkpad","port":"80","hostip":"127.0.0.1","user":" ","method":"GET","path":"/kibana-3.1.0/app/dashboards/guided.json?1410160186689","httpversion":"HTTP/1.1","returncode":"200","responsesize":"7017","referer":"http://127.0.0.1/kibana-3.1.0/index.html","agent":"Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0"}
2014-09-08T09:09:51+02:00 local.apache.access {"hostname":"thinkpad","port":"80","hostip":"::1","user":" ","method":"OPTIONS","path":"","httpversion":"HTTP/1.0","returncode":"200","responsesize":"125","referer":"-","agent":"Apache/2.4.6 (Debian) PHP/5.5.6-1 (internal dummy connection)"}
2014-09-08T09:09:52+02:00 local.apache.access {"hostname":"thinkpad","port":"80","hostip":"::1","user":" ","method":"OPTIONS","path":"
","httpversion":"HTTP/1.0","returncode":"200","responsesize":"125","referer":"-","agent":"Apache/2.4.6 (Debian) PHP/5.5.6-1 (internal dummy connection)"}
2014-09-08T09:09:53+02:00 local.apache.access {"hostname":"thinkpad","port":"80","hostip":"::1","user":" ","method":"OPTIONS","path":"*","httpversion":"HTTP/1.0","returncode":"200","responsesize":"125","referer":"-","agent":"Apache/2.4.6 (Debian) PHP/5.5.6-1 (internal dummy connection)"}

The fluentd log file is silent (after the startup output), also the elasticsearch.log is silent.

I don't know how to troubleshoot any further, all help is greatly appreciated.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.