When using the docker prospector and specifying containers.ids: * my logs are constantly spammed with:
2018-05-21T17:39:31.019Z ERROR reader/json.go:32 Error decoding JSON: json: cannot unmarshal number into Go value of type map[string]interface {}
I'm a bit confused because all of my logs are generated by Docker's json-logs driver which outputs valid JSON. The logs are killing filebeat. I understand the json.ignore_decoding_error option was introduced in 6.3 - but we are currently using 6.2.4 and I don't see published Docker images for 6.3 yet.
If I use the log prospector instead of docker and specify the oath as /var/lib/docker/container/*/*.log, the errors go away.
Maybe the problem is not in the logs but in the configuration, container.ids value needs to be a list, so in your case you would need to specify containers.ids: [*], try to change this.
I ran into the same issue. Changing to containers.ids: [*] causes the following error:
2018-06-12T16:48:31.126Z ERROR cfgfile/reload.go:237 Error loading config: invalid config: yaml: line 1: did not find expected alphabetic or numeric character
We ended up switching back to the "log" prospector:
filebeat.prospectors:
# Must use "log" prospector (instead of "docker") until 6.3 is released due to JSON errors
# The "docker" prospector also sets defaults for the json. values so they will need to be modified
# https://github.com/elastic/beats/issues/6045
- type: log
paths:
- '/var/lib/docker/containers/*/*.log'
# Hard-setting this to false causes decoded JSON fields to be under the "json" key
json.keys_under_root: true
json.add_error_key: true
json.message_key: log
processors:
- add_docker_metadata: ~
- decode_json_fields:
fields: ["log"]
If you are having problems, I would try using a similar configuration.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.