我正在尝试让瓦片 map 可视化在 Kibana 4.0.1 中运行。
我可以在发现部分看到 geoip.location
数据,但是当我转到将其可视化为 Tile map 时,我选择了 Geo Coordinates
存储桶类型,然后进行聚合输入 GeoHash
,然后当我转到 Field
时它是空白的。
- 基巴纳 4.0.1
- Logstash 1.4.2-1-2c0f5a1
- Elasticsearch 1.4.4
- 在 Debian 7 64 位上运行
这是我的 logstash 配置:
input {
udp {
port => 5514
type => cisco
}
}
filter {
grok {
match => { "message" => "\<%{NUMBER:num}\>%{NUMBER:seq}: \*%{SYSLOGTIMESTAMP:date}: \%SEC-6-IPACCESSLOGP: list Internet\-In\-%{WORD:acl_ver} denied %{WORD:protocol} %{IP:src}\(%{NUMBER:sport}\) \-\> %{IP:dest}\(%{NUMBER:dport}\), %{INT:hitcnt}" }
add_tag => ["grok_match", "cisco_acl_message"]
remove_field => [ "message" ]
}
geoip {
source => "src"
target => "geoip"
add_tag => ["geoip"]
database => "/etc/logstash/GeoLiteCity.dat"
}
}
output {
elasticsearch {
host => localhost
index => [ "firewall-%{+YYYY.MM.DD}" ]
}
}
这是一个日志记录的例子:
{
"_index": "firewall-2015.04.105",
"_type": "cisco",
"_id": "dJhGF6RtQuGXtlBTRCu2mQ",
"_score": null,
"_source": {
"@version": "1",
"@timestamp": "2015-04-15T21:06:08.357Z",
"type": "cisco",
"host": "172.17.10.1",
"num": "190",
"seq": "1872",
"date": "Apr 15 21:08:05.878",
"acl_ver": "20150223",
"protocol": "tcp",
"src": "94.102.51.96",
"sport": "26820",
"dest": "12.34.56.78",
"dport": "5900",
"hitcnt": "1",
"tags": [
"grok_match",
"cisco_acl_message",
"geoip",
"_grokparsefailure",
"geoip"
],
"geoip": {
"ip": "94.102.51.96",
"country_code2": "NL",
"country_code3": "NLD",
"country_name": "Netherlands",
"continent_code": "EU",
"region_name": "07",
"city_name": "Amsterdam",
"postal_code": "1000",
"latitude": 52.349999999999994,
"longitude": 4.916699999999992,
"timezone": "Europe/Amsterdam",
"real_region_name": "Noord-Holland",
"location": [
4.916699999999992,
52.349999999999994
],
"coordinates": [
4.916699999999992,
52.349999999999994
]
}
},
"fields": {
"@timestamp": [
1429131968357
]
},
"sort": [
1429131968357
]
}
知道我遗漏了什么吗?
回答
在 Alain 为我指出正确的方向后,我开始研究字段映射。以下是我的处理方式:
首先我检查了geoip
字段类型(我的索引叫做firewall*
)
curl http://localhost:9200/firewall*/_mapping/cisco/field/geoip.location?pretty
这回来了:
{
"firewall-2015.04.107" : {
"mappings" : {
"cisco" : {
"geoip.location" : {
"full_name" : "geoip.location",
"mapping":{"location":{"type":"float"}}
}
}
}
}
}
float
类型的位置是我无法添加瓦片 map 可视化的原因。我需要将其更改为 geo_point
。
经过大量挖掘,我发现一种将 location
类型映射更改为 geo_point
的方法是使用输出模板。我从
elasticsearch_templte.json
文件
/opt/logstash/lib/logstash/outputs/elasticsearch/elasticsearch-template.json
到
/etc/logstash/templates/elasticsearch-firewall.json
编辑它并将模板从 logstash*
更改为 firewall*
(或者任何您的索引名称模式)
"template":“防火墙*”
,
编辑 logstash 配置文件并将输出更改为:
output {
elasticsearch {
host => localhost
index => [ "firewall-%{+YYYY.MM.DD}" ]
template => "/etc/logstash/templates/elasticsearch-firewall.json"
template_name => "firewall"
}
}
删除防火墙*
索引。
警告:这将删除您现有的所有可搜索数据!如果此数据很重要,您将需要找到一种在不删除索引的情况下动态更改字段类型的方法。我在谷歌搜索中看到了这一点,所以我知道这是可能的。
curl -XDELETE http://localhost:9200/firewall*
之后我重新启动了 logstash 和 elasticsearch。
一旦我再次开始接收日志,我再次检查映射
curl http://localhost:9200/firewall*/_mapping/cisco/field/geoip.location?pretty
{
"firewall-2015.04.107" : {
"mappings" : {
"cisco" : {
"geoip.location" : {
"full_name" : "geoip.location",
"mapping":{"location":{"type":"geo_point"}}
}
}
}
}
}
查看位置类型现在如何 geo_point
:-)
现在我可以添加一个瓦片 map 可视化。
最佳答案
关于visualization - Kibana 4.0.1 中的 GeoHash 聚合下不存在 Tile Map geo.location 字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29661372/