解组 filebeat 配置中的错误

sha*_*ekh 5 yaml logstash elastic-stack

我已经为logstash配置了filebeat。但是在启动 filebeat 时我收到以下错误:

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.
Run Code Online (Sandbox Code Playgroud)

我已经在其他服务器上使用相同的配置配置了 filebeat,并且它工作正常,但我不明白为什么我会在此服务器上遇到此语法错误。

这是配置文件:

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.
Run Code Online (Sandbox Code Playgroud)

Jor*_*ing 4

我对 filebeat 一无所知(甚至对 Go 也一无所知),但是这个错误消息:

cannot unmarshal !!str `paths:
...` into []config.ProspectorConfig. Exiting.
Run Code Online (Sandbox Code Playgroud)

...对我来说,它期望该paths值是一个序列(YAML 中数组的用语),而不是标量(字符串)。而不是这个:

paths:
'/var/log/*.log'
Run Code Online (Sandbox Code Playgroud)

...尝试这个:

paths:
- '/var/log/*.log'
Run Code Online (Sandbox Code Playgroud)

...或者,因为这里的引号是无关的:

paths:
- /var/log/*.log
Run Code Online (Sandbox Code Playgroud)