您的位置 首页 elasticsearch

 filebeat写入数据到ES加密集群

filebeat 权限 到 es加密集群

在生产环境中,我们需要, 配置 es权限, 这一步: 参考: https://www.baimeidashu.com/10380.html

那么我们怎么再 filebeat 中 配置es 访问呢?

首先我们需要在kibana 单独创建一个角色

比如,我们直针对 baimei-filebeat*  索引起作用。

 

(2) 创建 filebeat 用户

名字随便 写

 

接下来我们 测试一下   filebeat写入数据到ES加密集群

vim filebeat_to_es.yaml

 

filebeat.inputs:
- type: log
  paths:
  - /tmp/apps.log


output.elasticsearch:
  username: "filebeat"
  password: "123456"
  hosts: 
  - "http://10.0.0.111:19200"
  - "http://10.0.0.112:19200"
  - "http://10.0.0.113:19200"
  index: "baimei-filebeat-apps-%{+yyyy.MM.dd}"    

setup.ilm.enabled: false
setup.template.name: "baimei-filebeat"
setup.template.pattern: "baimei-filebeat-apps*"
setup.template.overwrite: true
setup.template.settings:
  index.number_of_shards: 5
  index.number_of_replicas: 0

 

运行:

filebeat -e -c /root/config/filebeat_to_es.yaml 

 

这里遇到了问题:

 

ERROR	[publisher_pipeline_output]	pipeline/output.go:154	Failed to connect to backoff(elasticsearch(http://10.0.0.111:19200)): 403 Forbidden: {"error":{"root_cause":[{"type":"security_exception","reason":"action [cluster:monitor/main] is unauthorized for user [filebeat] with roles [baimei-filebeat], this action is granted by the cluster privileges [monitor,manage,all]"}],"type":"security_exception","reason":"action [cluster:monitor/main] is unauthorized for user [filebeat] with roles [baimei-filebeat], this action is granted by the cluster privileges [monitor,manage,all]"},"status":403}

403 是权限的问题, 我们去kibana 配置一下

必须有  集群 的 mange权限, 还有 创建索引的 和写的权限  , 这3个必须有的。

不然你的数据总是写不进去的。

 

filebeat -e -c /root/config/filebeat_to_es.yaml  | grep message

 

测试成功

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章