Filebeat“加载配置文件时出错:yaml:未找到预期的密钥”

Eco*_*ech 3 filebeat

我对这个问题很困惑。

我有一个启用了 x-pack 安全性的 Elasticsearch 服务器。具有 Filebeat 的客户端将输出发送到该服务器。一切正常,无需启用 x-pck 安全性,但在执行此操作时,我会收到此错误消息。

./filebeat test config -v
Exiting: error loading config file: yaml: line 157: did not find expected key
Run Code Online (Sandbox Code Playgroud)

导致错误的行是“用户名”和“密码”。注释时,配置测试正常,但是当用户名和密码取消注释时,出现错误

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch.hosts: ["X.X.X.X:9200"]

  # Array of hosts to connect to.
  #hosts: ["localhost:9200"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "<password_generated_in_server>"
Run Code Online (Sandbox Code Playgroud)

连接与 XGET 请求正常工作,如下所示:

curl -XGET 'http://X.X.X.X:9200/_all/_search?q=*&pretty' -u elastic:<password_generated_in_server>
Run Code Online (Sandbox Code Playgroud)

我需要激活任何 x-pack 模块、选项或手动创建用户吗?

我启用的模块是system、elasticsearch 和auditd。我在客户端中使用 go build for arm。

谢谢

Eco*_*ech 6

解决了。

看来配置文件的语法相当严格......这种方式工作正常:

setup.kibana:
  host: "http://X.X.X.X:5601"

output.elasticsearch:
  hosts: ["http://X.X.X.X:9200"]
  username: "elastic"
  password: "<passwd>"
Run Code Online (Sandbox Code Playgroud)