这是我的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
谢谢你的任何提示
发布于 2021-09-10 04:07:25
根据您发布的内容,您的index
声明似乎放在了错误的位置,因为它在输入而不是输出中
https://www.elastic.co/guide/en/beats/filebeat/current/elasticsearch-output.html#index-option-es描述了你想要做什么,但是试试这个;
output.elasticsearch:
hosts: ["http://eshost:9200"]
index: "%{[fields.my_type]}-%{[agent.version]}-%{+yyyy.MM.dd}"
并将其从输入中删除
https://stackoverflow.com/questions/69115540
复制相似问题