简体   繁体   English

将日志发送到elasticsearch时logstash输出错误

[英]logstash output error in sending logs to elasticsearch

I read my services logs using filebeat ,then filebeat sends the logs to logstash for parsing.我使用 filebeat 读取我的服务日志,然后 filebeat 将日志发送到 logstash 进行解析。 logstash sends the parsed logs to elasticsearch to be indexed. logstash 将解析后的日志发送到 elasticsearch 进行索引。 But today this error happens in logstash and no logs is indexed in elasticsearch.但是今天这个错误发生在logstash中,并且没有日志在elasticsearch中被索引。

[2021-11-02T11:35:36,774][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. [2021-11-02T11:35:36,774][WARN][logstash.outputs.elasticsearch] 无法将事件索引到 Elasticsearch。 {:status=>400, :action=>["index", {:_id=>nil, :_inde ::Event:0xf85da17>], :response=>{"index"=>{"_index"=>"logstash-alias-000015", "_type"=>"_doc", "_id"=>"YNas33wBlcfHwocoMbSU", "status"=>400, "error"=>{"type" ls.Usage.UserUsage] of type [float] in document with id 'YNas33wBlcfHwocoMbSU'. {:status=>400, :action=>["index", {:_id=>nil, :_inde ::Event:0xf85da17>], :response=>{"index"=>{"_index"=>" logstash-alias-000015", "_type"=>"_doc", "_id"=>"YNas33wBlcfHwocoMbSU", "status"=>400, "error"=>{"type" ls.Usage.UserUsage] 类型 [浮动] 在 ID 为“YNas33wBlcfHwocoMbSU”的文档中。 Preview of field's value: 'NaN'", "caused_by"=>{"type"=>"illegal_argument_exc ]"}}}}}字段值预览:'NaN'", "caused_by"=>{"type"=>"illegal_argument_exc ]"}}}}}

I searched but did not find a clue, Any help is much appreciated.我搜索但没有找到线索,非常感谢任何帮助。

According to the error you get, a field called ls.Usage.UserUsage of type float contains the value 'NaN' which is not a float.根据您得到的错误,一个名为ls.Usage.UserUsage的 float 类型字段包含值'NaN' ,它不是一个浮点数。

What you could do is to modify your mapping to set the ignore_malformed setting to true so that this value is ignored, but it won't prevent the document from being indexed.您可以做的是修改您的映射以将ignore_malformed设置设置为 true 以便忽略此值,但它不会阻止文档被索引。

The other option is to make sure to not produce such wrong values upstream.另一种选择是确保不会在上游产生这样的错误值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM