我知道那里有30个相同的问题,但是我无法用其中一个答案解决我的问题。我的索引工作了7天,然后决定使用以下方法删除数据:
DELETE csv
因为我确实重复上传了同一日期进行测试。此后,我尝试再次上传数据,因此我只得到了一份。我没有更改即时上传的.csv文件中的任何内容。
但是我得到了错误信息:
[2017-11-29T14:23:44,345][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"csv", :_type=>"csv", :_routing=>nil}, 2017-10-01T04:13:19.000Z DESKTOP-*** **.0.0.201,Fred Orr ,Fred_Orr@**.s**m,2017-10-01;06:13:19,** Story: This Tiny Pill Changes Everythi], :response=>{"index"=>{"_index"=>"csv", "_type"=>"csv", "_id"=>"*****", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [timestamp]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: \"2017-10-01;06:13:19\" is malformed at \";06:13:19\""}}}}}
在logstash中,我有以下配置:
date {
match => ["timestamp", "YYYY-MM-dd;HH:mm:ss"]
target => "@timestamp"
}
我在csv文件中的日期是:2017-10-01; 06:13:19
我尝试将其与2017-10-01; 06:13:19进行匹配?但是它在; 06:13:19部分失败。怎么了?
我试图更换; --或空格,但没有任何作用。
所以:
2017-10-01 06:13:19
2017-10-01-06:13:19
但是我在下半段不断出错。
对应:
"properties": {
"@timestamp": {
"type": "date"
},
我不明白怎么了?在删除inde之前它就起作用了
最佳答案
对于非格式语法,您需要在该值前后加上单引号字符。尝试以下方法:
date {
match => ["timestamp", "YYYY-MM-dd';'HH:mm:ss"]
target => "@timestamp"
}
关于date - Elasticsearch无法解析[时间戳记],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47554235/