elasticsearch

edit
  • Version: 4.0.2
  • Released on: February 7, 2017
  • Changelog

Getting Help

edit

For questions about the plugin, open a topic in the Discuss forums. For bugs or feature requests, open an issue in Github. For the list of Elastic supported plugins, please consult the Elastic Support Matrix.

Description

edit

Read from an Elasticsearch cluster, based on search query results. This is useful for replaying test logs, reindexing, etc.

Example:

    input {
      # Read all documents from Elasticsearch matching the given query
      elasticsearch {
        hosts => "localhost"
        query => '{ "query": { "match": { "statuscode": 200 } }, "sort": [ "_doc" ] }'
      }
    }

This would create an Elasticsearch query with the following format:

    curl 'http://localhost:9200/logstash-*/_search?&scroll=1m&size=1000' -d '{
      "query": {
        "match": {
          "statuscode": 200
        }
      },
      "sort": [ "_doc" ]
    }'

 

Synopsis

edit

This plugin supports the following configuration options:

Required configuration options:

elasticsearch {
}

Available configuration options:

Details

edit

 

add_field

edit
  • Value type is hash
  • Default value is {}

Add a field to an event

ca_file

edit
  • Value type is path
  • There is no default value for this setting.

SSL Certificate Authority file in PEM encoded format, must also include any chain certificates as necessary

codec

edit
  • Value type is codec
  • Default value is "plain"

The codec used for input data. Input codecs are a convenient method for decoding your data before it enters the input, without needing a separate filter in your Logstash pipeline.

docinfo

edit
  • Value type is boolean
  • Default value is false

If set, include Elasticsearch document information such as index, type, and the id in the event.

It might be important to note, with regards to metadata, that if you’re ingesting documents with the intent to re-index them (or just update them) that the action option in the elasticsearch output wants to know how to handle those things. It can be dynamically assigned with a field added to the metadata.

Example

    input {
      elasticsearch {
        hosts => "es.production.mysite.org"
        index => "mydata-2018.09.*"
        query => "*"
        size => 500
        scroll => "5m"
        docinfo => true
      }
    }
    output {
      elasticsearch {
        index => "copy-of-production.%{[@metadata][_index]}"
        index_type => "%{[@metadata][_type]}"
        document_id => "%{[@metadata][_id]}"
      }
    }

docinfo_fields

edit
  • Value type is array
  • Default value is ["_index", "_type", "_id"]

List of document metadata to move to the docinfo_target field To learn more about Elasticsearch metadata fields read http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_document_metadata.html

docinfo_target

edit
  • Value type is string
  • Default value is "@metadata"

Where to move the Elasticsearch document information by default we use the @metadata field.

enable_metric

edit
  • Value type is boolean
  • Default value is true

Disable or enable metric logging for this specific plugin instance by default we record all the metrics we can, but you can disable metrics collection for a specific plugin.

hosts

edit
  • Value type is array
  • There is no default value for this setting.

List of elasticsearch hosts to use for querying. each host can be either IP, HOST, IP:port or HOST:port port defaults to 9200

  • Value type is string
  • There is no default value for this setting.

Add a unique ID to the plugin configuration. If no ID is specified, Logstash will generate one. It is strongly recommended to set this ID in your configuration. This is particularly useful when you have two or more plugins of the same type, for example, if you have 2 grok filters. Adding a named ID in this case will help in monitoring Logstash when using the monitoring APIs.

output {
 stdout {
   id => "my_plugin_id"
 }
}

index

edit
  • Value type is string
  • Default value is "logstash-*"

The index or alias to search.

password

edit
  • Value type is password
  • There is no default value for this setting.

Basic Auth - password

query

edit
  • Value type is string
  • Default value is "{ \"sort\": [ \"_doc\" ] }"

The query to be executed. Read the Elasticsearch query DSL documentation for more info https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html

scroll

edit
  • Value type is string
  • Default value is "1m"

This parameter controls the keepalive time in seconds of the scrolling request and initiates the scrolling process. The timeout applies per round trip (i.e. between the previous scroll request, to the next).

size

edit
  • Value type is number
  • Default value is 1000

This allows you to set the maximum number of hits returned per scroll.

ssl

edit
  • Value type is boolean
  • Default value is false

SSL

tags

edit
  • Value type is array
  • There is no default value for this setting.

Add any number of arbitrary tags to your event.

This can help with processing later.

type

edit
  • Value type is string
  • There is no default value for this setting.

This is the base class for Logstash inputs. Add a type field to all events handled by this input.

Types are used mainly for filter activation.

The type is stored as part of the event itself, so you can also use the type to search for it in Kibana.

If you try to set a type on an event that already has one (for example when you send an event from a shipper to an indexer) then a new input will not override the existing type. A type set at the shipper stays with that event for its life even when sent to another Logstash server.

user

edit
  • Value type is string
  • There is no default value for this setting.

Basic Auth - username