I am attempting to create a geo-point data type so that I can utilize the map features in kibana. My index will not show as an option when I attempt to add a layer and I believe its because I do not have a geo-point datatype in my index. So I am attempting to create a new field that combines the longitude and latitude values from two other fields. See configs below:
Logstash:
filter {
if [log_type] == "suricata" {
json {
source => "message"
}
date {
match => [ "timestamp", "ISO8601" ]
}
if ![geoip] and [src_ip] !~ /^(10\.|192\.168\.)/ {
geoip {
add_tag => [ "GeoIP" ]
source => "src_ip"
}
}
if [geoip.latitude][geoip.longitude] {
mutate {
add_field => ["geoipgeopoint","%{[geoip.latitude][geoip.longitude]}"]
}
}
}
}
The fields geoip.latitude and geoip.longitude are added to events once the second if condition is matched succesfully. I've tried adding the add_field to the geoip filter but the filter isn't utilized for all events.
I am not seeing any error message in the logs but here is a snippet of the log file that shows a few lines before and after the new field I am attempting to create:
[2020-05-19T15:42:57,071][DEBUG][logstash.plugins.registry] On demand adding plugin to the registry {:name=>"geoip", :type=>"filter", :class=>LogStash::Filters::GeoIP}
[2020-05-19T15:42:57,082][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@add_tag = ["GeoIP"]
[2020-05-19T15:42:57,084][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@source = "src_ip"
[2020-05-19T15:42:57,086][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@id = "2307da31962e7901d09e6ecd33099645fbf9daaea2db320e76e18e09543da8e0"
[2020-05-19T15:42:57,087][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@enable_metric = true
[2020-05-19T15:42:57,088][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@remove_tag = []
[2020-05-19T15:42:57,090][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@add_field = {}
[2020-05-19T15:42:57,091][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@remove_field = []
[2020-05-19T15:42:57,092][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@periodic_flush = false
[2020-05-19T15:42:57,094][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@default_database_type = "City"
[2020-05-19T15:42:57,095][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@target = "geoip"
[2020-05-19T15:42:57,096][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@cache_size = 1000
[2020-05-19T15:42:57,098][DEBUG][logstash.filters.geoip ] config LogStash::Filters::GeoIP/@tag_on_failure = ["_geoip_lookup_failure"]
[2020-05-19T15:42:57,109][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@add_field = {"geoipgeopoint"=>"%{[geoip.latitude][geoip.longitude]}"}
[2020-05-19T15:42:57,110][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@id = "46cb237597e7ad7c2133dc354e37e014806ce1baaba913e5ffddc82532c99288"
[2020-05-19T15:42:57,112][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@enable_metric = true
[2020-05-19T15:42:57,114][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@add_tag = []
[2020-05-19T15:42:57,115][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@remove_tag = []
[2020-05-19T15:42:57,117][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@remove_field = []
[2020-05-19T15:42:57,118][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@periodic_flush = false
[2020-05-19T15:42:57,120][DEBUG][logstash.filters.mutate ] config LogStash::Filters::Mutate/@tag_on_failure = "_mutate_error"
[2020-05-19T15:43:04,505][DEBUG][org.logstash.config.ir.CompiledPipeline][main] Compiled filter
P[filter-mutate{"add_field"=>["geoipgeopoint", "%{[geoip.latitude][geoip.longitude]}"]}|[file]/etc/logstash/conf.d/04_suricata.conf:19:4:
mutate {
add_field => ["geoipgeopoint","%{[geoip.latitude][geoip.longitude]}"]
}
```] into org.logstash.config.ir.compiler.ComputeStepSyntaxElement@bc28d924
Template for index:
{
"suricata" : {
"order" : 0,
"index_patterns" : [
"my-suricata-*-*-*"
],
"settings" : {
"index" : {
"number_of_shards" : "3",
"number_of_replicas" : "0"
}
},
"mappings" : {
"properties" : {
"geoipgeopoint" : {
"type" : "geo_point"
}
}
},
"aliases" : { }
}
}
Data is still being parsed but I am not seeing new field in Kibana.