trying to use elasticsearch input plugin to read lots of indices using scan scroll shuts down
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
I'm trying to do something like this:
input {
elasticsearch {
```
hosts => ["localhost:3000"]
scan => true
scroll => "10m"
index => "logstash-*"
docinfo => true
}
```
}
output {
stdout { codec => rubydebug }
```
elasticsearch {
hosts => ["http://localhost:3000"]
index => "combinedlogstash"
document_type => "%{[@metadata][_type]}"
document_id => "%{[@metadata][_id]}"
}
```
}
to merge lots of small indexes into one index. However, using \* in the index name of the elasticsearch input seems to just shutdown the pipeline. If I use the explicit name of one index, it works fine. The debug messages look like this:
Reading config file {:file=>"logstash/agent.rb", :level=>:debug, :line=>"318", :method=>"local_config"}
Compiled pipeline code:
@inputs = []
@filters = []
@outputs = []
@periodic_flushers = []
@shutdown_flushers = []
```
@input_elasticsearch_1 = plugin("input", "elasticsearch", LogStash::Util.hash_merge_many({ "hosts" => [("localhost:3000")] }, { "scan" => ("true") }, { "scroll" => ("10m") }, { "index" => ("logstash-1995*") }, { "docinfo" => ("true") }))
@inputs << @input_elasticsearch_1
@output_stdout_2 = plugin("output", "stdout", LogStash::Util.hash_merge_many({ "codec" => ("rubydebug") }))
@outputs << @output_stdout_2
```
def filter_func(event)
events = [event]
@logger.debug? && @logger.debug("filter received", :event => event.to_hash)
events
end
def output_func(event)
@logger.debug? && @logger.debug("output received", :event => event.to_hash)
@output_stdout_2.handle(event)
end {:level=>:debug, :file=>"logstash/pipeline.rb", :line=>"37", :method=>"initialize"}
Plugin not defined in namespace, checking for plugin file {:type=>"input", :name=>"elasticsearch", :path=>"logstash/inputs/elasticsearch", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"71", :method=>"lookup"}
Plugin not defined in namespace, checking for plugin file {:type=>"codec", :name=>"json", :path=>"logstash/codecs/json", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"71", :method=>"lookup"}
config LogStash::Codecs::JSON/@charset = "UTF-8" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@hosts = ["localhost:3000"] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@scan = true {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@scroll = "10m" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@index = "logstash-1995_" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@docinfo = true {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@codec = "UTF-8"> {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@add_field = {} {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
input {
config LogStash::Inputs::Elasticsearch/@query = "{\"query\": { \"match_all\": {} } }" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@size = 1000 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@docinfo_target = "@metadata" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@docinfo_fields = ["_index", "_type", "_id"] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Elasticsearch/@ssl = false {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
Plugin not defined in namespace, checking for plugin file {:type=>"output", :name=>"stdout", :path=>"logstash/outputs/stdout", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"71", :method=>"lookup"}
Plugin not defined in namespace, checking for plugin file {:type=>"codec", :name=>"rubydebug", :path=>"logstash/codecs/rubydebug", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"71", :method=>"lookup"}
config LogStash::Codecs::RubyDebug/@metadata = false {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Outputs::Stdout/@codec = false> {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Outputs::Stdout/@workers = 1 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
Default settings used: Filter workers: 4
Pipeline started {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"89", :method=>"run"}
Logstash startup completed
closing {:plugin=>["localhost:3000"], scan=>true, scroll=>"10m", index=>"logstash-1995_", docinfo=>true, codec=>"UTF-8">, query=>"{\"query\": { \"match_all\": {} } }", size=>1000, docinfo_target=>"@metadata", docinfo_fields=>["_index", "_type", "_id"], ssl=>false>, :level=>:debug, :file=>"logstash/plugin.rb", :line=>"35", :method=>"do_close"}
closing {:plugin=>false>, workers=>1>, :level=>:debug, :file=>"logstash/plugin.rb", :line=>"35", :method=>"do_close"}
Pipeline shutdown complete. {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"103", :method=>"run"}
Logstash shutdown completed
This is on logstash 2.0.0 but I'm happy to try this on a more recent release.
Sarwar
Contributor guide
Assessment
This issue has not been assessed yet.