我得到了一些日志,例如:
2015-09-25 12:07:55.441 INFO 17328 --- [][][][]
XXX.YYY.SomeClass : Someone request in CityX!
我将它导入到Elasticsearch
:
{
"_index": "logstash-2015.09.25",
"_type": "redis-input",
"_id": "AVADGRo7JaVbcBhehzEj",
"_score": 1,
"_source": {
"@timestamp": "2015-09-25T12:21:24.616+08:00",
"@version": 1,
"message": "Someone request in CityX!",
"logger_name": "XXX.YYY.SomeClass",
"thread_name": "pool-22-thread-1",
"level": "INFO",
"level_value": 20000,
"HOSTNAME": "host",
"host": "192.168.5.194: 57154",
"type": "redis-input"
}
}
我只想将CityX
(我的日志中出现任何城市,并假设我们可以获得每个城市的纬度和经度)映射到GeoPoint
in Elasticsearch
,以便我们可以在 map by 中显示用户请求的计数Kibana
。我该怎么做?
整个管道:
logstash(:4560) --> redis(:6379) --> logstash-indexer --> elasticsearch (:9200)
配置:
Logstash -> Redis:
input {
tcp {
port => 4560
codec => json_lines
}
}
output {
redis {
host => "10.0.40.155"
port => 6379
data_type => "list"
key => "key_count"
}
}
Redis -> Logstash -> Elasticsearch:
input {
redis {
host => "127.0.0.1"
port => 6379
type => "redis-input"
data_type => "list"
key => "key_count"
}
}
output {
stdout {}
elasticsearch {
host => "10.0.40.156"
cluster => "elasticsearch"
codec => "json"
protocol => "http"
}
}