Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unmarshal errors in filebeat configuration

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
like image 333
sharvil_parekh Avatar asked Sep 26 '22 00:09

sharvil_parekh


1 Answers

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
like image 139
Jordan Running Avatar answered Sep 30 '22 08:09

Jordan Running