logstash geo ip在https输出

时间:2018-12-03 11:04:00

标签: logstash geoip

我正在尝试通过logstash通过http输出将geoip解析的信息发送到我的服务。不幸的是,我好像无法访问在输出中创建的geoip对象。

grok {
    geoip { source => "ip" }
    }

这是我的http输出

output {
  if "LogIp" in [message] {
    http {
      url => "https://xxx/%{UserId}"
      http_method => "post"
      format => "json"
      message => '{"latitude":"%{geoip.latitude}", "country_name":"%{geoip.country_name}"}'
      headers => [
        'Authorization', 'Bearer xxx'
      ]
    }

我的身体没有任何价值。我尝试对其进行测试,然后将其放入路径变量中,但我却无法正常工作,因此无法访问该值。

这就是它在我的松紧带中的样子

"_source": {
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15",
    "UserId": "admin",
    "ip": "185.53.133.18",
    "app_name": "user",
    "geoip": {
      "latitude": 52.2394,
      "ip": "185.53.133.18",
      "location": {
        "lon": 21.0362,
        "lat": 52.2394
      },
      "longitude": 21.0362,
      "country_code2": "PL",
      "timezone": "Europe/Warsaw",
      "country_code3": "PL",
      "continent_code": "EU",
      "country_name": "Poland"
    },

因此我可以访问属性UserId,但无法从geoip获取值。

0 个答案:

没有答案
相关问题