【发布时间】:2016-12-19 15:11:11
【问题描述】:
我在弹性搜索中有一个索引,它有一个名为 locationCoordinates 的字段。它正在从 logstash 发送到 ElasticSearch。
该字段中的数据如下所示...
-38.122, 145.025
当此字段出现在 ElasticSearch 中时,它不会作为地理点出现。
我知道如果我在下面这样做,它会起作用。
{
"mappings": {
"logs": {
"properties": {
"http_request.locationCoordinates": {
"type": "geo_point"
}
}
}
}
}
但我想知道的是如何更改我的 logstash.conf 文件,以便它在启动时执行此操作。
目前我的 logstash.conf 看起来有点像这样......
input {
# Default GELF input
gelf {
port => 12201
type => gelf
}
# Default TCP input
tcp {
port => 5000
type => syslog
}
# Default UDP input
udp {
port => 5001
type => prod
codec => json
}
file {
path => [ "/tmp/app-logs/*.log" ]
codec => json {
charset => "UTF-8"
}
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
json{
source => "message"
}
}
output {
elasticsearch {
hosts => "elasticsearch:9200"
}
}
我最终在 Kibana 中得到了这个(没有小地理标志)。
【问题讨论】:
-
这个答案应该会有所帮助:stackoverflow.com/questions/35844409/…
-
嗨@Val。感谢您的回复。是的,我看过那篇帖子,但这对我来说仍然不是很清楚。我已经根据那篇文章尝试了一些东西,但我认为如果可能的话我需要更清楚一些。
-
很公平。您可以将
elasticsearch输出配置添加到您的问题中吗? -
你想从 es 中看到什么? elasticsearch.yml?
-
elasticsearch输出配置来自您的 logstash 配置(在过滤器下方)