【问题标题】:How to fix "_geoip_lookup_failure" tag with logstash filter "geoip" when posting a json with http to logstash将带有http的json发布到logstash时如何使用logstash过滤器“geoip”修复“_geoip_lookup_failure”标签
【发布时间】:2019-04-15 19:28:24
【问题描述】:

我正在从应用程序向 logstash 发布一个 json,希望通过 logstashes geoip 插件获取 IP 地址的位置。但是我得到了 _geoip_lookup_failure。

这是我的logstash配置

    http {
        port => "4200"
        codec => json
    }
}
filter{
    geoip {
    source => "clientip"
  }
}
output {
  elasticsearch { hosts => ["localhost:9200"] }
  stdout { codec => rubydebug }
}

这是我发布到港口的内容:

{'used_credentials': [
    {'username': 'l', 'number_of_usages': 1, 'used_commands': {},
'get_access': 'false', 
'timestamps': {'1': '04/15/2019, 21:08:54'}, 'password': 'l'}],
 'clientip': '192.168.xxx.xx', 
'unsuccessfull_logins': 1}

这就是我在logstash中得到的:

{
    "unsuccessfull_logins" => 1,
                "@version" => "1",
        "used_credentials" => [
        [0] {
                    "username" => "l",
               "used_commands" => {},
                    "password" => "l",
                  "timestamps" => {
                "1" => "04/15/2019, 21:08:54"
            },
            "number_of_usages" => 1,
                  "get_access" => "false"
        }
    ],
                "clientip" => "192.168.xxx.xx",
              "@timestamp" => 2019-04-15T19:08:57.147Z,
                    "host" => "127.0.0.1",
                 "headers" => {
           "request_path" => "/telnet",
             "connection" => "keep-alive",
        "accept_encoding" => "gzip, deflate",
           "http_version" => "HTTP/1.1",
         "content_length" => "227",
        "http_user_agent" => "python-requests/2.21.0",
         "request_method" => "POST",
            "http_accept" => "*/*",
           "content_type" => "application/json",
              "http_host" => "127.0.0.1:4200"
    },
                   "geoip" => {},
                    "tags" => [
        [0] "_geoip_lookup_failure"
    ]
}

我不明白为什么输入被正确识别但 goeip 没有找到它

【问题讨论】:

    标签: json logstash logstash-filter


    【解决方案1】:

    问题是您的clientip 位于192.168.0.0/16 网络中,这是一个仅供本地使用的专用网络,它不存在于geoip 过滤器使用的数据库中。

    geoip 过滤器仅适用于公共 IP 地址。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多