在遵循此tuto(https://www.bmc.com/blogs/elasticsearch-logs-beats-logstash/)以使用logstash分析某些日志文件之后,我的索引在第一次创建时就很好,然后我想用新的过滤器和新的存储库重新索引新文件,因此我通过“curl XDELETE”删除了”索引,现在当我重新启动logstash和filebeat时,不再创建索引。。启动组件时,我看不到任何错误。
是否需要删除其他内容才能重新创建索引?
最佳答案
好的,因为我的猜测(请参阅评论)是正确的,所以这里的解释是:
为避免filebeat反复读取和发布文件行,它使用注册表来存储收割机的当前状态:
The registry file stores the state and location information that Filebeat uses to track where it was last reading.
如您所述,filebeat成功收获了文件,将行发送到logstash,logstash将事件发布到了elasticsearch,后者创建了所需的索引。由于filebeat更新了其注册表,因此无需删除更多行,因此即使删除索引,也不会将事件再次发布到logstash。当您插入一些新行时,filebeat重新打开了收割机,并仅将新行(在“注册表检查点”之后)发布到logstash。
注册表文件的默认位置是
${path.data}/registry
(请参阅Filebeat's Directory Layout Overview)。... maybe the curl api call is not the best solution to restart the index
这与删除索引无关。删除索引发生在elasticsearch内部。 Filebeat不了解您在Elasticsearch中的操作。
Q: Is there a way to re-create an index based on old logs?
是的,您应该考虑以下几种方法:
希望我能为您服务。
关于elasticsearch - ELK Logstash无法在ES中创建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59561751/