почему плагин logstash geoip не может найти ip в базе данных? - PullRequest
0 голосов
/ 22 марта 2019

Я использую стек ELK для сбора системных журналов с брандмауэра iptables.Попытка визуализировать данные с помощью геоип фильтра.Logstash conf выглядит:

filter {
  if [type] == "syslog" {
    mutate {
      gsub => [
#     replace all "= " with double quotes to truly indicate no value
      "message", "= ", '="" '
      ]
    }
    kv {
      id => "syslog_kv"
      source => "message"
      trim_key => " "
      trim_value => " "
      value_split => "="
      field_split => " "
    }

    #now check if source IP is a private IP, if so, tag it   
    cidr {
      address => [ "%{src_ip}" ]
      add_tag => [ "src_internalIP" ]
      network => [ "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" ]
    }
    
    # don't run geoip if it's internalIP, otherwise find the GEOIP location
    if "src_internalIP" not in [tags] {
      geoip {
        add_tag => [ "src_geoip" ]
        source => "src_ip"
      }
    } 
	else {
      #check DST IP now.  If it is a private IP, tag it 
      cidr {
        add_tag => [ "dst_internalIP" ]
        address => [ "%{dst_ip}" ]
        network => [ "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" ]
      }
    
      # don't run geoip if it's internalIP, otherwise find the GEOIP location
      if "dst_internalIP" not in [tags] {
        geoip {
          add_tag => [ "dst_geoip" ]
          source => "dst_ip"
	database => "/etc/logstash/GeoLite2-City.mmdb"
        }
      }
    }
  }
}

В кибане я вижу только теги _geoip_lookup_failure для каждого события.В журнале отладки

[2019-03-22T20:21:18,135][DEBUG][logstash.filters.geoip   ] IP  was not found in the database {:event=>#<LogStash::Event:0x5f71a6be>}
[2019-03-22T20:21:18,136][WARN ][logstash.filters.cidr    ] Invalid IP address, skipping {:address=>"%{src_ip}", :event=>#<LogStash::Event:0x79cf2cf0>}

Формат входных данных:

	<30>2019:03:22-20:16:49 hostname ulogd[13334]: id="2002" severity="info" sys="SecureNet" sub="packetfilter" name="Packet accepted" action="accept" fwrule="8" initf="eth2" outitf="eth0" srcmac="70:79:b3:ab:e0:e8" dstmac="00:1a:8c:f0:89:02" srcip="10.0.125.11" dstip="13.78.180.50" proto="6" length="52" tos="0x00" prec="0x00" ttl="126" srcport="53180" dstport="443" tcpflags="SYN" 

Помогите, пожалуйста, решить эту проблему.Пытаюсь найти решение.

...