Starting out with ELK stack, initially to work with Cisco ASA firewall logs. It's been a bit of a learning curve regarding the mapping template config, I finally managed to get the IP addresses mapped to type:ip (after finding that logstash config output section requires "template_overwrite => true" !)
Now I've got geoip (sort of) working, but having problems doing geoip for both the source ip address and destination ip address.
I'm running
elasticsearch 1.7.1 build[b88f43f/2015-07-29T09:54:16Z]
logstash 1.5.4
It all works fine when doing a geoip for either src OR dst ip adddress.
But when I define both the src_geoip AND dst_geoip in the template like this...
<snipped>
"properties" : {
"@timestamp": { "type": "date", "doc_values" : true },
"@version": { "type": "string", "index": "not_analyzed" },
"src_ip" : { "type": "ip", "doc_values" : true, "index": "not_analyzed" },
"dst_ip" : { "type": "ip", "doc_values" : true, "index": "not_analyzed" },
"dst_geoip" : {
"type" : "object",
"dynamic": true,
"properties" : {
"location" : { "type" : "geo_point", "doc_values" : true },
"ip": { "type": "ip", "doc_values" : true, "index" : "not_analyzed" },
"latitude" : { "type" : "float", "doc_values" : true },
"longitude" : { "type" : "float", "doc_values" : true }
}
}
},
"src_geoip" : {
"type" : "object",
"dynamic": true,
"properties" : {
"location" : { "type" : "geo_point", "doc_values" : true },
"ip": { "type": "ip", "doc_values" : true, "index" : "not_analyzed" },
"latitude" : { "type" : "float", "doc_values" : true },
"longitude" : { "type" : "float", "doc_values" : true }
}
}
}
}
From logstash filter config...
geoip {
database => "/opt/logstash/vendor/geoip/GeoLiteCity.dat"
source => "src_ip"
target => "src_geoip"
}
geoip {
database => "/opt/logstash/vendor/geoip/GeoLiteCity.dat"
source => "dst_ip"
target => "dst_geoip"
}
ES fails to create the index...
[2015-09-09 10:27:18,068][DEBUG][action.admin.indices.create] [Will o' the Wisp] [logstash-2015.08.15] failed to create
org.elasticsearch.index.mapper.MapperParsingException: mapping [_default_]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:382)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:374)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:196)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:162)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root type mapping not empty after parsing! Remaining fields: [src_geoip : {dynamic=true, type=object, properties={ip={index=not_analyzed, type=ip, doc_values=true}, latitude={type=float, doc_values=true}, location={type=geo_point, doc_values=true}, longitude={type=float, doc_values=true}}}]
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:278)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:192)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:177)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:294)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:379)
... 6 more
I have confirmed that the mapping template is being loaded OK in logstash startup.
I'm wondering if there might be some kind of name clash between both sets of geoip data?
Thanks in advance for any pointers. Rgds, Graeme