【发布时间】:2016-10-15 04:44:08
【问题描述】:
所以我想存储在 Elasticsearch 中的数据是一个 csv 文件。它包含以下内容:
1465309033156,84,http://test.com/purchase.php,200,OK,ThreadGroup 1-3,true,6,6,84,testPC,0
1465309033469,176,http://test.com/,200,OK,ThreadGroup 1-7,true,7,7,176,testPC,91
请注意,第一行等于 UNIX_MS 中的时间。
我正在尝试使用 logstash 发送数据。这是我的配置文件:
input {
file {
sincedb_path => "NUL"
ignore_older => 0
type => "csv"
path => ["C:/result/piet.jtl"]
start_position => "beginning"
}
}
filter {
csv {
columns => ["@jmeter_timestamp", ...]
separator => ","
}
date {
locale => "en"
match => ["@jmeter_timestamp", "UNIX_MS"]
remove_field => ["@jmeter_timestamp"]
target => "@timestamp"
timezone => "Europe/Amsterdam"
}
}
output {
elasticsearch {
template => "c:/result/piet.json"
template_name => "piet"
hosts => ["192.168.43.51:9200"]
index => "piet-%{+YYYY.MM.dd}"
}
}
这是 piet.json 的一部分:
"mappings": {
"logs": {
"properties": {
"@timestamp": {
"type": "date"
},
现在我在运行配置文件时遇到错误。
"error"=>{
"type"=>"mapper_parsing_exception",
"reason"=>"failed to parse [@timestamp]",
"caused_by"=>{
"type"=>"illegal_argument_exception",
"reason"=>"Invalid format: \"2016-06-07T14:17:34.611Z\" is malformed at \"-06-07T14:17:34.611Z\""
}}}}, :level=>:warn}
我的标准输出如下所示:
我只是迷路了。如何在 Elasticsearch 中插入 csv 文件中的数据..
【问题讨论】:
标签: ruby json templates elasticsearch logstash