Logstash/Kibana GeoIP 不工作

Logstash/Kibana GeoIP not working

我正在尝试使用 ELK 堆栈创建 GeoIP 数据,它可以在 Kibana 中可视化。

我最近在 Ubuntu Server 14.04 的虚拟实例上安装了 ELK 堆栈(Elastic Search、Logstash 和 Kibana)。我正在使用 Bro 来捕获日志。

除了 GeoIP(最有趣的功能之一!)之外,在 Kibana 中捕获日志、解析日志和查看它们的一切工作都很好。

我的 logstash 配置文件的 GeoIP 部分如下所示;

geoip {
  add_tag => [ "geoip" ]
  database => "/etc/logstash/GeoLiteCity.dat" 
  source => "id.orig_h"
  target => "geoip"
  add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}"]
  add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
}
mutate {
  convert => [ "[geoip][coordinates]", "float" ]
}

我从 the following guide to setup GeoIP with Kibana. 那里得到了那部分过滤器,我也看到在其他几个地方使用了那个过滤器。 我试图简化过滤器(只是源、目标、数据库),但没有成功。

当我对索引执行 curl 请求时,尤其是 add_tag ["geoip"] 它 returns 空白数据;

"geoip" : {
        "dynamic" : "true",
        "properties" : {
          "location" : {
            "type" : "geo_point"
          }
        }

最后,这是我直接从 Kibana 获取的一些经过清理的数据,格式为 JSON;

{
  "_index": "logstash-2015.11.12",
  "_type": "bro-conn_log",
  "_id": "*****",
  "_score": null,
  "_source": {
    "message": [
      "*****"
    ],
    "@version": "1",
    "@timestamp": "2015-11-12T13:43:16.205Z",
    "host": "elk",
    "path": "/nsm/bro/logs/current/conn.log",
    "type": "bro-conn_log",
    "ts": "*****",
    "uid": "*****",
    "id.orig_h": "*****",
    "id.orig_p": *****,
    "id.resp_h": "*****",
    "id.resp_p": *****,
    "proto": "*****",
    "service": "*****",
    "duration": *****,
    "orig_bytes": *****,
    "resp_bytes": *****,
    "conn_state": "*****",
    "local_orig": "*****",
    "missed_bytes": *****,
    "history": "*****",
    "orig_pkts": *****,
    "orig_ip_bytes": *****,
    "resp_pkts": *****,
    "resp_ip_bytes": *****,
    "tunnel_parents": "*****",
    "column21": "(empty)",
    "conn_state_full": "*****"
  },
  "fields": {
    "@timestamp": [
      1447335796205
    ]
  },
  "sort": [
    1447335796205
  ]
}

总而言之:我正在尝试使用 ELK 堆栈获取 GeoIP 数据。尽管以下指南描述了如何做到这一点,但 GeoIP 字段不会显示在 Kibana 中。任何建议将不胜感激。

非常愚蠢的解决方案。我查看的 IP 地址都是内部的。我假设(错误地)它只会为任何无法解析的 IP 地址生成空的 GeoIP 数据。但是,正如 geoIP 文档所述:

Starting with version 1.3.0 of Logstash, a [geoip][location] field is created if the GeoIP lookup returns a latitude and longitude.

因此,如果没有经度和纬度,就永远不会创建 GeoIP 字段。这已通过将机器移至更开放的网络并立即看到具有上述相同过滤器的 GeoIP 标签来确认。