我试图使用logstash及其配置将一些JSON数据导入到我的Elasticsearch和Kibana集群中。我正在使用具有三个字段的JSON文件。
elasticsearch version used: 6.5.3
logstash version used: 6.5.3
使用的Logstash版本:6.5.3
示例JSON文件: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"}
我的配置文件: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 }
}
我正在尝试使用以下命令使用logstash将此数据导入elasticsearch:
bin/logstash -f ../../data/test.config
但是我收到以下错误消息:
[2018-12-27T20:18:41,439] [错误] [logstash.pipeline] 错误注册 插件{:pipeline_id =>“ main”, :plugin =>“#, @filter = {\“名称\” => \“文本\”, \“得分\” => \“浮动\”,\“地址\” => \“文本\”}, id => \“ 4a292b8b637c63de89c36b730212b3c706307f5fd385080369ac0cbeac3c2d53 \”,enable_metric => true,period_flush => false >>“,:error =>” translation 缺少:en.logstash.agent.configuration.invalid_plugin_register”, :thread =>“#”}
[2018-12-27T20:18:41,452] [错误] [logstash.pipeline] 管道中止 由于错误{: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
每个“”, “ /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:在register'", "/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
每个“”, “ /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
也许是_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
运行'“, “ /Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:160:in `开始中的阻止'“],:thread =>”#“}[2018-12-27T20:18:41,474] [错误] [logstash.agent] 无法执行 动作{:id =>:main, :action_type => LogStash :: ConvergeResult :: FailedAction,:message =>“可以 无法执行动作:PipelineAction :: Create,action_result: false”,:backtrace => nil}
[2018-12-27T20:18:41,705] [INFO] [logstash.agent] 已成功启动 Logstash API端点{:port => 9600}
此外,如果我从文件test.config中删除了mutate过滤器,它也可以正常工作。但是,我想将 得分 变量的类型更改为float。尝试在解析过程中更改字段是否存在问题,或者我缺少其他内容?谢谢:)
答案 0 :(得分:0)
似乎您不能使用“文本”,请使用“名称” =>“字符串”