
[英]Is it possible to define two ILM policies in single filebeat.yml
[英]Define field type with add_fields processor in filebeat.yml?
看着这对添加字段的文档,我看到filebeat可以通过名称和值将被附加到由Filebeat每记录推向Elasticsearch添加任何自定义字段。
这在 filebeat.yml 中定义:
processors:
- add_fields:
target: project
fields:
name: myproject
id: '574734885120952459'
有没有办法,严格地从 filebeat.yml,给这里添加的字段一个“类型”? 例如,我可以指定“name”来输入“keyword”吗?
我见过的唯一完成方法不涉及 filebeat.yml,而是在 filebeat 目录中创建自定义 fields.yml 文件(这都适用于任何节拍),并在“节拍”键下指定字段和类型。
例如,如果上面的字段“id”在 filebeat.yml 中声明,并且我们希望它是“关键字”类型的自定义字段,我们将执行以下操作:
将 fields.yml 复制到 filebeat 目录中的 my_filebeat_fields.yml 文件中。 在 my_filebeat_fields 中,添加以下部分:
- key: beat
anchor: beat-common
title: Beat
description: >
Contains common beat fields available in all event types.
fields:
# your customization begins here:
- name: id
- type: keyword
然后执行以下操作以使用这个新的自定义字段文件:
修改 filebeat.yml 的这一部分以包括:
#==================== Elasticsearch template setting ==========================
setup.template.name: "filebeat-*"
setup.template.fields: "my_filebeat_fields.yml"
setup.template.overwrite: true
然后按照本指南以适合您环境的任何方法将模板加载到弹性中。
(假设所有内容都是 7.x 版)
编辑:
显然在 filebeat.yml 文件中设置“setup.template.append_fields”选项也可以,但我还没有探索过。
https://www.elastic.co/guide/en/beats/filebeat/current/configuration-template.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.