弹性云、filebeat和密钥/令牌身份验证

ncgqoxb0  于 2021-06-10  发布在  ElasticSearch
关注(0)|答案(1)|浏览(550)

是否可以配置filebeat使用令牌身份验证与弹性云示例通信?
根据文档,如果我使用云示例,我应该配置 cloud.id 以及 cloud.authfilebeat.yml ```
cloud.id: "..."
cloud.auth: "filebeat_setup:YOUR_PASSWORD"

医生说 `cloud.auth` 应该是我的弹性云示例的用户名和密码。我想改用api\ U密钥。但是,当我配置api密钥时

output.elasticsearch:

Authentication credentials - either API key or username/password.

api_key: "key-id:key-value"

尝试测试我的连接,

$ sudo filebeat test output
elasticsearch: https://...:443...
parse url... OK
connection...
parse host... OK
dns lookup... OK
addresses: 52.202.123.120, 18.214.74.184, 50.19.154.221
dial up... OK
TLS...
security: server's certificate chain verification is enabled
handshake... OK
TLS version: TLSv1.2
dial up... OK
talk to server... ERROR 401 Unauthorized: {"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}},"status":401}

看来 `filebeat` 不确认我的api密钥

"root_cause":[
{
"type":"security_exception",
"reason":"missing authentication credentials for REST request [/]"
/* ... */

我已经成功地用 `@elastic/elasticsearch` 使用此令牌的javascript包。
在我继续调试这个问题之前——是否可以使用令牌身份验证通过 `filebeat` ? 或者是 `filebeat` 仅支持用户名/密码身份验证?
u5rb5r59

u5rb5r591#

这个问题的答案是:是的,你可以用 api_key 使用filebeat,即使您使用的是elastic cloud。
而在我的配置测试期间收到的错误消息
缺少rest请求的身份验证凭据
表示身份验证丢失,真正的问题是我以前成功使用的密钥最近过期。我假设filebeat尝试了api密钥,但被拒绝,然后又重新尝试用户凭据。当这些凭证丢失时,它给出了上述错误。

相关问题