Shi*_*ppa 5 amazon-web-services elasticsearch aws-elasticsearch elastic-beats
我在使用 Elasticsearch 方面拥有丰富的经验,我使用过 2.4 版本,现在正在尝试学习新的 Elasticsearch。我正在尝试实现 Filebeat 将我的 apache 和系统日志发送到我的 Elasticsearch 端点。为了节省时间,我更愿意在公共域下通过 AWS Elasticsearch Service 启动 t2.medium 单节点实例,并且我已附加访问策略以允许每个人访问集群。AWS Elasticsearch 实例已启动并运行正常。我启动了 Ubuntu(18.04) 服务器,下载了 filebeat tar 并在中进行了以下配置filebeat.yml:
#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["https://my-public-test-domain.ap-southeast-1.es.amazonaws.com:443"]
18.04- # Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
#password: "changeme"
Run Code Online (Sandbox Code Playgroud)
我启用了所需的模块:
filebeat modules enable system apache
Run Code Online (Sandbox Code Playgroud)
然后根据 filebeat 文档,我更改了 filebeat 文件的所有权,并使用以下命令启动 filebeat:
sudo chown root filebeat.yml
sudo ./filebeat -e
Run Code Online (Sandbox Code Playgroud)
当我启动 filebeat 时,我遇到了以下权限和所有权问题:
Error loading config from file '/home/ubuntu/beats/filebeat-7.2.0-linux-x86_64/modules.d/system.yml', error invalid config: config file ("/home/ubuntu/beats/filebeat-7.2.0-linux-x86_64/modules.d/system.yml") must be owned by the user identifier (uid=0) or root
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我更改了引发错误的文件的所有权。当我重新启动 filebeat 服务时,我开始面临以下问题:
Connection marked as failed because the onConnect callback failed: cannot retrieve the elasticsearch license: unauthorized access, could not connect to the xpack endpoint, verify your credentials
Run Code Online (Sandbox Code Playgroud)
通过此链接,我发现要使用 AWS Elasticsearch,我需要 Beats OSS 版本。所以我再次从此
链接
下载了beat的OSS版本,并按照与上面相同的步骤进行操作,但仍然没有成功。现在我面临以下错误:
错误1:
Attempting to reconnect to backoff(elasticsearch(https://my-public-test-domain.ap-southeast-1.es.amazonaws.com:443)) with 12 reconnect attempt(s)
Run Code Online (Sandbox Code Playgroud)
错误2:
Failed to connect to backoff(elasticsearch(https://my-public-test-domain.ap-southeast-1.es.amazonaws.com:443)): Connection marked as failed because the onConnect callback failed: 1 error: Error loading pipeline for fileset system/auth: This module requires an Elasticsearch plugin that provides the geoip processor. Please visit the Elasticsearch documentation for instructions on how to install this plugin. Response body: {"error":{"root_cause":[{"type":"parse_exception","reason":"No processor type exists with name [geoip]","header":{"processor_type":"geoip"}}],"type":"parse_exception","reason":"No processor type exists with name [geoip]","header":{"processor_type":"geoip"}},"status":400}
Run Code Online (Sandbox Code Playgroud)
从第二个错误中我可以了解到 geoip 插件不可用,因此我面临此错误。
还需要做什么才能使其正常工作?
有人成功将 Beats 连接到 AWS Elasticsearch 吗?
我还可以采取哪些其他措施来缓解上述问题?
环境详情:
首先,您需要将 OSS 版本的 filebeat 与 AWS ES 一起使用https://www.elastic.co/downloads/beats/filebeat-oss
其次,AWS ElasticSearch 不提供 GeoIP 模块,因此您需要编辑要使用的任何默认模块的管道,并确保删除/注释掉 GeoIP。
例如/usr/share/filebeat/module/system/auth/ingest/pipeline.json(这是从 deb 包安装时的路径 - 当然你的路径会不同)注释掉:
{
"geoip": {
"field": "source.ip",
"target_field": "source.geo",
"ignore_failure": true
}
},
Run Code Online (Sandbox Code Playgroud)
对 apache 模块重复相同的操作。
| 归档时间: |
|
| 查看次数: |
9502 次 |
| 最近记录: |