I'm trying to reformat my index template to migrate to ECS. I think I'm missing something because the field format for the multi-level keys is not taken into account.
My index template looks like this :
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "fwlogs"
},
"codec": "best_compression",
"mapping": {
"ignore_malformed": "true"
},
"refresh_interval": "60s",
"number_of_replicas": "0"
}
},
"mappings": {
"dynamic_templates": [],
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "keyword",
"index": false
},
"event": {
"properties": {
"category": {
"type": "keyword",
"ignore_above": 1024
},
"kind": {
"type": "keyword",
"ignore_above": 1024
},
"module": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"host": {
"type": "ip"
},
"message": {
"type": "text"
}
}
},
"aliases": {}
}
}
But my indices show "unknown field" for all multi-level fields :
I'm using this logstash filter to translate my fields :
filter{
if [host] in ["...", "..."] {
mutate {
add_field => { "event.category" => "network" }
add_field => { "event.kind" => "event" }
add_field => { "event.module" => "juniper" }
}
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:timestamp_tmp} - %{DATA:vpn} - \[%{IPV4:src_ip}\] %{DATA:src_user}\(%{WORD:domain}\)\[%{DATA:role}\] - %{GREEDYDATA:juni_message}" ]
}
if [juni_message] =~ /Key Exchange number [0-9]+ occurred for user with NCIP/ {
grok {
match => [ "juni_message", "Key Exchange number %{NUMBER} occurred for user with NCIP %{IP:client.ip}" ]
}
} else if [juni_message] =~ /is deleted since user does not qualify reevaluated policies/ {
mutate {
add_field => { "event.reason" => "User does not qualify reevaluated policies" }
}
}
mutate {
remove_field => [ "juni_message" ]
}
}
}
I'm probably missing a flag or a small tip either in logstash or in the index template, but I can't figure out where.
Any idea ?