Our setup looks like:
filebeat -> logstash -> elasticsearch
After upgrading some of our servers from filebeat 5.x to filebeat to 7.x we seem to be hitting some sort of field type mismatch. We use daily indexes using the logstash-* pattern. When the daily index flips I start getting these errors:
[2020-03-03T17:09:36,070][DEBUG][o.e.a.b.TransportShardBulkAction] [ps-dev-elk] [logstash-2020.03.03][0] failed to execute bulk item (index) index {[logstash-2020.03.03][_doc][fuFfoXABQ1tpPHB50Pa-], source[{"name":"Other","referrer":""-"","@version":"1","os":"Other","verb":"GET","message":"127.0.0.1 - - [03/Mar/2020:17:09:34 +0000] "GET /server-status?auto HTTP/1.1" 200 1488 "-" "-" "-"","clientip":"127.0.0.1","request":"/server-status?auto","os_name":"Other","agent":""-"","type":"apache","timestamp":"03/Mar/2020:17:09:34 +0000","auth":"-","source":"/var/log/apache2/benefits.log","beat":{"version":"5.6.16","name":"ps-partner-dev-web01.domain.com","hostname":"ps-partner-dev-web01.domain.com"},"bytes":1488,"httpversion":"1.1","response":"200","input_type":"log","device":"Other","build":"","offset":4838529,"requestid":""-"","ident":"-","@timestamp":"2020-03-03T17:09:34.000Z","tags":["beats_input_codec_plain_applied","internalIP"]}]}
org.elasticsearch.index.mapper.MapperParsingException: object mapping for [agent] tried to parse field [agent] as object, but found a concrete value
The agent field is coming from apache logs. Using the built in HTTPD_COMBINEDLOG grok, it sets the agent field to a QS (quoted string).
Deleting the daily index and letting it get re-created the errors stop and logs start flowing in.
I checked the mapping for our index in kibana and agent is set to string.
I turned on rubydebug output in elasticsearch to compare the logs from a host running filebeat 5.x and a host running filebeat 7.x and the output looks the same:
5.x:
"agent" => ""-"",
7.x:
"agent" => ""curl/7.47.0"",
looks the same to me.
I checked out logstash-* template and there is no mention of agent so it must be dynamically creating this from input. I can't figure out where or why it's trying to set this field to an object. Any help would be much appreciated.