I am trying to import some JSON data into my Elasticsearch and Kibana cluster using logstash and its configuration. I am using a JSON file having three fields.
elasticsearch version used: 6.5.3
logstash version used: 6.5.3
Logstash version used: 6.5.3
Sample JSON file: test.json
{"name":"Jonathan","score":"9.9","address":"New Delhi"}
{"name":"Sam","score":"8.9","address":"New York"}
{"name":"Michelle","score":"9.0","address":"California"}
My configuration file: test.config
input{
file{
path => "/Users/amit/elasticsearch/data/test.json"
codec => json
sincedb_path => "/dev/null"
start_position => "beginning"
}
}
filter{
json{
source => "message"
}
mutate{
convert => {
"name" => "text"
"score" => "float"
"address" => "text"
}
}
}
output{
elasticsearch{
hosts => "localhost:9200"
index => "test"
}
stdout { codec => rubydebug }
}
I am trying to import this data into elasticsearch using logstash using the following command:
bin/logstash -f ../../data/test.config
But I get the following error message:
[2018-12-27T20:18:41,439][ERROR][logstash.pipeline] Error registering plugin {:pipeline_id=>"main", :plugin=>"#, @filter={\"name\"=>\"text\", \"score\"=>\"float\", \"address\"=>\"text\"}, id=>\"4a292b8b637c63de89c36b730212b3c706307f5fd385080369ac0cbeac3c2d53\", enable_metric=>true, periodic_flush=>false>>", :error=>"translation missing: en.logstash.agent.configuration.invalid_plugin_register", :thread=>"#"}
[2018-12-27T20:18:41,452][ERROR][logstash.pipeline] Pipeline aborted due to error {:pipeline_id=>"main", :exception=>#, :backtrace=>["/Users/amit/elasticsearch/logstash/logstash-6.5.3/vendor/bundle/jruby/2.3.0/gems/logstash-filter-mutate-3.3.4/lib/logstash/filters/mutate.rb:219:in
block in register'", "org/jruby/RubyHash.java:1343:in
each'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/vendor/bundle/jruby/2.3.0/gems/logstash-filter-mutate-3.3.4/lib/logstash/filters/mutate.rb:217:inregister'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:242:in
register_plugin'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:253:inblock in register_plugins'", "org/jruby/RubyArray.java:1734:in
each'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:253:inregister_plugins'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:595:in
maybe_setup_out_plugins'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:263:instart_workers'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:200:in
run'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:160:in `block in start'"], :thread=>"#"}[2018-12-27T20:18:41,474][ERROR][logstash.agent] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create, action_result: false", :backtrace=>nil}
[2018-12-27T20:18:41,705][INFO ][logstash.agent] Successfully started Logstash API endpoint {:port=>9600}
Also, if I remove the mutate filter from the file test.config, it works fine. But, I want to change the type of score variable to float. Is there a problem in trying to mutate the fields during parsing or I am missing something else? Thanks :)