elasticsearch - filebeat 没有用我的名字创建索引
问题描述
我正在使用 filebeat 将我的应用程序日志发送到 Elasticsearch 并直接连接到我的 Elasticsearch 以发送日志。
我的文件节拍配置
filebeat.config:
modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
filebeat.inputs:
- type: log
paths:
- "/var/log/*.log"
setup.ilm.enabled: false
setup.template.overwrite: true
output.elasticsearch:
hosts: ["aws-es:443"]
output.elasticsearch.index: "myapp-%{[agent.version]}-%{+yyyy.MM.dd}"
username: '${ELASTICSEARCH_USERNAME:}'
password: '${ELASTICSEARCH_PASSWORD:}
请注意,output.elasticsearch.index:
我在 Elasticsearch 中将 myapp 作为我的索引名称的前缀,但 filebeat 正在使用filebeat-7.7.0-2020.05.31
名称创建索引,即使用它自己的名称filebeat
作为前缀,因为我有多个应用程序并希望创建一个单独的索引他们。
解决方案
您需要
按照错误消息中的说明setup.template.name
进行设置。setup.template.pattern
请在您的 filebeat.yml 中添加以下额外行。
setup.template:
name: 'myapp'
pattern: 'myapp-*'
enabled: false
现在你的完整filebeat.yml
应该看起来像
filebeat.config: 模块: 路径: $ { path.config } /modules.d/ * .yml reload.enabled: false
filebeat.inputs:
-type: log
paths:
-"/var/log/*.log"
setup.ilm.enabled: false
setup.template.overwrite: true
output.elasticsearch:
hosts: ["aws-es:443"]
output.elasticsearch.index: "myapp-%{[agent.version]}-%{+yyyy.MM.dd}"
username: '${ELASTICSEARCH_USERNAME:}'
password: '${ELASTICSEARCH_PASSWORD:}
setup.template:
name: 'myapp'
pattern: 'myapp-*'
enabled: false
推荐阅读
- tensorflow - tf.compat.v1 和 tf.compat.v2 的别名和区别是什么?
- python - guizero Raspberry Pi:按钮 -> 命令序列问题
- flutter - Dart:如何检查非常具体的异常?
- html - VBA网页抓取更新
- r - 使用 nlm() 优化函数中的常量
- c# - 在 ASP.NET 中按角色重定向登录
- c# - Entity Framework Core 如何在生产环境中执行迁移
- oracle - 如何比较oracle中的两个集合值?
- java - Bitshifts:如何在 Java 中将十进制转换为位移值
- rust - 何时在方法中使用 self、&self、&mut self?