unmarshal errors in filebeat configuration

sharvil_parekh picture sharvil_parekh · Dec 7, 2015 · Viewed 13.1k times · Source

I have configured filebeat for logstash. But while starting the filebeat I am getting following error :

main.go:42: CRIT Config error: Error reading config file: YAML config parsing failed on /etc/filebeat/filebeat.yml: yaml: unmarshal errors:
  line 2: cannot unmarshal !!str `paths:
...` into []config.ProspectorConfig. Exiting.

I have configured filebeat on other server with same configuration and there it is working perfectly but I don't understand why am I getting this syntax error on this server.

Here is the configuration file :

filebeat:
  prospectors: |-
    paths:
    '/var/log/*.log'
  registry_file: /var/lib/filebeat/registry
  config_dir: /etc/filebeat/conf.d
output:
  elasticsearch:
    enabled: false
    hosts:
    - 52.35.55.85:9200
  logstash:
    enabled: true
    hosts:
    - 52.32.18.237:5044
  file:
    enabled: false
    path: /tmp/filebeat
    filename: filebeat
    rotate_every_kb: 1000
    number_of_files: 7

Answer

Jordan Running picture Jordan Running · Dec 7, 2015

I don't know anything about filebeat (or even Go, really), but this error message:

cannot unmarshal !!str `paths:
...` into []config.ProspectorConfig. Exiting.

...suggests to me that it's expecing the paths value to be a sequence (YAML parlance for array), not a scalar (string). Instead of this:

paths:
'/var/log/*.log'

...try this:

paths:
- '/var/log/*.log'

...or, since the quotes are extraneous here:

paths:
- /var/log/*.log