我刚开始使用Logstash解析CSV文档。 CSV文档只有两列"日期"和"高"。我已经阅读了各种配置来解析日期,但我不能,在这个领域给我错误。日期格式为DD / MM / YYYY,错误告诉我以下内容:
Failed parsing date from field {:field=>"Date", :value=>"Date", :exception=>"Invalid format: \"Date\"", :config_parsers=>"dd/MM/YYYY", :config_locale=>"default=es_ES", :level=>:warn}
这是我用来过滤Logstash的配置文件:
input {
file {
path => "/path/to/data.csv"
start_position => "beginning"
}
}
filter {
csv {
separator => ","
columns => ["Date","High"]
}
date{
match => [ "Date", "dd/MM/YYYY" ]
}
mutate {convert => ["High", "float"]}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
action => "index"
index => "machine"
workers => 1
}
stdout { codec => rubydebug }
}
谢谢!
答案 0 :(得分:0)
在date
插件中,尝试更改match
设置中的字母大小写。像这样:
date{
match => [ "Date", "DD/MM/YYYY" ]
}
如果没有帮助尝试将它们全部小写。
答案 1 :(得分:0)
格式字符串dd/MM/yyyy
应该有效。您可以在the JodaTime documentation中找到格式化字符串的详细规范。