问题描述
我将数据从logstash推送到elasticsearch,但是我注意到数据类型不匹配。我有geo_points是字符串,date是字符串,等等。
如何从Logstash conf文件中设置字段类型?我已经看到我可以放置一条命令来更改类型,但是鉴于我每天都会创建一个新索引,因此我也不想自动执行这些命令。
我认为可以从conf文件中的过滤器或输出中执行此操作。我只是不知道在哪里或如何。
这就是我一直在努力的事情。
input {
http_poller {
...
}
}
filter {
split {
field => "[bustime-response][vehicle]"
}
mutate {
rename => {
"[bustime-response][vehicle][vid]" => "vid"
"[bustime-response][vehicle][rtpidatafeed]" => "rtpidatafeed"
"[bustime-response][vehicle][tmstmp]" => "tmstmp"
"[bustime-response][vehicle][lat]" => "lat"
"[bustime-response][vehicle][lon]" => "lon"
"[bustime-response][vehicle][hdg]" => "hdg"
"[bustime-response][vehicle][pid]" => "pid"
"[bustime-response][vehicle][rt]" => "rt"
"[bustime-response][vehicle][des]" => "des"
"[bustime-response][vehicle][pdist]" => "pdist"
"[bustime-response][vehicle][dly]" => "dly"
"[bustime-response][vehicle][spd]" => "spd"
"[bustime-response][vehicle][tatripid]" => "tatripid"
"[bustime-response][vehicle][origtatripno]" => "origtatripno"
"[bustime-response][vehicle][tablockid]" => "tablockid"
"[bustime-response][vehicle][zone]" => "zone"
"[bustime-response][vehicle][mode]" => "mode"
"[bustime-response][vehicle][psgld]" => "psgld"
}
}
mutate {
add_field => { "location" => "%{lat},%{lon}" }
}
}
output {
elasticsearch {
hosts => [ "${ES_HOSTS}" ]
user => "${ES_USER}"
password => "${ES_PASSWORD}"
cacert => '/etc/logstash/certificates/ca.crt'
index => "transit-pittsburgh-%{+YYYY.MM.dd}"
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)