【发布时间】:2021-11-05 23:07:42
【问题描述】:
这是我的 filebeat.yml 文件:
filebeat.config:
modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
processors:
- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_kubernetes_metadata: ~
output.elasticsearch:
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
username: '${ELASTICSEARCH_USERNAME:}'
password: '${ELASTICSEARCH_PASSWORD:}'
setup.kibana:
host: '${KIBANA_HOST}'
ssl.enabled: false
filebeat.modules:
- module: kibana
- module: elasticsearch
fields_under_root: true
json.keys_under_root: true
filebeat.inputs:
- type: log
enabled: true
fields:
my_type: 'inventory'
index: 'test-%{[fields.my_type]}-%{+yyyy.MM.dd}'
paths:
- /var/log/kibana/kibana.log
setup.ilm.overwrite: true
setup.ilm.enabled: false
setup.template.name: 'test-%{[fields.my_type]}-%{+yyyy.MM.dd}'
setup.template.pattern: 'test-%{[fields.my_type]}-*'
我想从我的字段值创建索引名称(特别是日志文件名) 当我尝试使用诸如
之类的代理字段时,它会起作用%{[agent.version]}
但是当我尝试从我的自定义字段或其他可用字段中命名时出错
%{[file.name]} or %{[fields.my_type]}
这是来自 filebeat 日志的错误:
ERROR [publisher] pipeline/client.go:106 Failed to publish event: key not found
感谢任何提示
【问题讨论】:
-
你试过
%{[my_type]}吗? -
@Filip 是的,我做到了。
标签: elasticsearch elastic-stack filebeat