我正在尝试使用logstash及其配置将一些json数据导入elasticsearch和kibana集群。我使用的json文件有三个字段。
elasticsearch version used: 6.5.3
logstash version used: 6.5.3
使用的日志存储版本: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:41439][error][logstash.pipeline]注册插件时出错{:pipeline id=>“main”,:plugin=>“#,@filter=>”name\“=>\”text\”,\”score\“=>\”float\”,\”address\“=>\”text\”},id=>“4a292b8b637c63de89c36b730212b3c706307f5fd385080369ac0cbeac3c2d53\”,启用\u metric=>true,定期\u flush=>false>>“,:error=>“翻译丢失:en.logstash.agent.configuration.invalid_plugin_register”,:thread=>“#”}
[2018-12-27t20:18:41452][error][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:in register'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:242:in
注册“/users/amit/elasticsearch/logstash/logstash-6.5.3/logstash core/lib/logstash/pipeline.rb:253:in block in register_plugins'", "org/jruby/RubyArray.java:1734:in
每个/users/amit/elasticsearch/logstash/logstash-6.5.3/logstash core/lib/logstash/pipeline.rb:253:in register_plugins'", "/Users/amit/elasticsearch/logstash/logstash-6.5.3/logstash-core/lib/logstash/pipeline.rb:595:in
可能是“setup out”插件“,/users/amit/elasticsearch/logstash/logstash-6.5.3/logstash core/lib/logstash/pipeline.rb:263:in start_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‘block in start'”,:thread=>“#”}
[2018-12-27t20:18:41474][error][logstash.agent]无法执行操作{:id=>:main,:action\u type=>logstash::convergeresult::failedaction,:message=>“无法执行操作:pipelineaction::create,action\u result:false”,:backtrace=>nil}
[2018-12-27t20:18:41705][info][logstash.agent]已成功启动logstash api终结点{:port=>9600}
另外,如果我从test.config文件中删除mutate过滤器,它也可以正常工作。但是,我想把score变量的类型改为float。在解析过程中尝试改变字段是否有问题,或者我遗漏了其他内容?谢谢:)
1条答案
按热度按时间wecizke31#
https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-过滤器变异转换
似乎你不能使用“文本”,使用“名称”=>“字符串”