Filebeat启动失败的问题
ELK安装过程遇到的问题
在安装ELK的过程中用到了Filebeat,按照官网教程一路下来,(只是在写入es时,自定义了index)在最后启动服务的时候,启动失败。
通过查看日志找到了原因:
journalctl -u filebeat.service
详解失败原因如下:
从日志中我们可以看出:在设置了index的时候,我们就必须要设置以下两项
setup.template.name: "demo"
109 setup.template.pattern: "demo-*"
设置完这两项后,服务可以起来,但发现index并未按照自定义的格式,仍然使用的是系统默认的格式!
系统默认格式为:
filebeat-%{[agent.version]}-*
于是又开始了无休止的查找官网文档,最终找到了原因,请看如下官网原文:
The index name to write events to when you’re using daily indices. The
default is “filebeat-%{[agent.version]}-%{+yyyy.MM.dd}”, for example,
“filebeat-7.12.0-2021-04-21”. If you change this setting, you also
need to configure the setup.template.name and setup.template.pattern
options (see Elasticsearch index template).If you are using the pre-built Kibana dashboards, you also need to set
the setup.dashboards.index option (see Kibana dashboards).When index lifecycle management (ILM) is enabled, the default index is
“filebeat-%{[agent.version]}-%{+yyyy.MM.dd}-%{index_num}”, for
example, “filebeat-7.12.0-2021-04-21-000001”.
Custom index settings
are ignored when ILM is enabled.
If you’re sending events to a cluster
that supports index lifecycle management, see Index lifecycle
management (ILM) to learn how to change the index name.
官网说的很明确了,当ILM启用时,自定义的index不生效,我们要想用自定义的index,还需要关闭ILM功能。
setup.ilm.enabled:false
至此,问题解决。