I'm having a problem where logstash is loading a template file, but either it's not applying it, or this isn't being communicated to Elastic.
(This is using Security Onion, which has logstash in Docker)
I have a logstash filter that adds a field "network_name", this is visibile in Kibana but as it's not an idex I can't use it for filters.
My tests from within Docker...
Check the template file is binding correctly and being used by Docker
$ ls -lt /logstash-template.json
-rw-r--r-- 1 root root 77692 Jun 1 16:21 /logstash-template.json
Check this file has my config:
bash-4.2$ grep "network_name" /logstash-template.json -A 6
"network_name":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
}
Check the file is being loaded
bash-4.2$ grep "logstash-template" /var/log/logstash/logstash.log | tail -n 5
[2020-06-01T15:38:16,981][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>"/logstash-template.json"}
Check the file has the right contents (positive, "network_name" exists near the end)
[2020-06-01T16:28:32,641][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>"/logstash-template.json"}
[2020-06-01T16:28:32,646][INFO ][logstash.outputs.elasticsearch] e"=>"keywo [..removed...] pe"=>"ip"}, "network_name"=>{"type"=>"text", "fields"=>{"keyword"=>{"type"=>"keyword"}}}, "year"=>{"type"=>"long"}}}}}}
"z" is a defaultfield, as a second test I removed it
bash-4.2$ grep "\"z\"" /logstash-template.json | wc -l
0
However it does not appear this file that is loaded is applied. In Kibana when I:
management -> index patterns -> reindex
....z is still listed, network_name is not
Can anyone add advice please.
Is it possible/how do I test deeper if the updated template file is being applied
Are any changes needed pushing to Elastic to honour this change?
Many thanks
Andy